insert form int sql db via sql

Results 1 to 2 of 2

Thread: insert form int sql db via sql

  1. #1
    Lord+Have+MERCY Guest

    Default insert form int sql db via sql

    this is the code i use to connect it doesnt work:data_source = "driver=(SQL Server);;uid=sa;pwd=;database=TNUserData_Data"<BR> sql_insert = "insert into TNUserData (Name1, Name2, Email, Country, Age, Gender, PostalCode) values (&#039" & Name1 & "&#039, &#039" & Name2 & "&#039, &#039" & Email &"&#039, &#039" & Country &"&#039, &#039" & Age &"&#039, &#039" & Gender &"&#039, &#039" & PostalCode &"&#039)"<BR><BR><BR>&#039create the connection object and opening the database<BR> <BR>Set con = Server.CreateObject("ADODB.connection")<BR>con.Ope n data_source<BR>con.Execute sql_insert<BR><BR>&#039 done...Close the connection!!!<BR><BR>con.Close<BR>Set con = Nothing<BR><BR>this is the error i get:<BR><BR>Error Type:<BR>Microsoft OLE DB Provider for ODBC Drivers (0x80004005)<BR>[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified<BR>/formcollect.asp, line 85<BR><BR><BR>this is what line 85 says:<BR><BR>con.Open data_source<BR><BR>

  2. #2
    Steve Cimino Guest

    Default RE: insert form int sql db via sql

    You have an extra ; in your statement, right after driver. Lose it, and I think everything should work (assuming the database exists).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts