Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert SQL problem (Jamie)

Status
Not open for further replies.

777axa

Technical User
Jul 30, 2002
48
US
I don't know what happend to previous thred.
Below is what worked for me.
Note: I think that the problem was that you named your fields with reserved words like time or date - use prefixes - showTime, showDate

In your case [ ] around the names are needed
--------------------------------------------------
Dim varDate, varTime, varVenue, varLocation, varInfo

varDate=Request.Form("date")
varTime=Request.Form("time")
varVenue=Request.Form("venue")
varLocation=Request.Form("location")
varInfo=Request.Form("info")

Set cn = Server.CreateObject("ADODB.Connection")
cn.open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\_webs\db\database.mdb;Persist Security Info=False")

sql="INSERT INTO shows_table ([date], [time], [venue], [location], [info]) VALUES ("

sql=sql & "'" & varDate & "'"
sql=sql & ", '" & varTime & "'"
sql=sql & ", '" & varVenue & "'"
sql=sql & ", '" & varLocation & "'"
sql=sql & ", '" & varInfo & "')"
response.write sql ' look at your actual string
cn.Execute sql

cn.close
cn=nothing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top