Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
slapmonkay
Starting Member
2 Posts |
Posted - 2006-02-18 : 16:50:05
|
[code]<% ' Declaring variables Dim data_source, con, sql_insertSeason, Game, Season, Size ' A Function to check if some field entered by user is empty Function ChkString(string) If string = "" Then string = " " ChkString = Replace(string, "'", "''") End Function ' Receiving values from Form Game = ChkString(Request.Form("Game")) Season = ChkString(Request.Form("Season")) Size = ChkString(Request.Form("Size")) data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _ Server.MapPath("..\DB\TCSLPlayoffs.mdb") sql_insertSeason = "insert into GameSize (Game, Season, Size) values ('" & _Game & "', '" & Season &"', '" & Size &"')" ' Creating Connection Object and opening the database Set con = Server.CreateObject("ADODB.Connection") con.Open data_source con.Execute sql_insertSeason ' Done. Close the connection con.Close Set con = Nothing Response.Redirect "AddSeasonComplete.asp" %>[/code]Causes the following error. does anyone know what i did incorrect in the statment. Thanks.[code]Microsoft JET Database Engine error '80040e14'Syntax error in INSERT INTO statement./slapmonkay/TCSLPlayoffs/Admin/AddSeasonDB.asp, line 34 [/code] |
|
Kristen
Test
22859 Posts |
Posted - 2006-02-19 : 04:15:44
|
Maybe Game, Season or Size has a single quote in it?Try puttingResponse.Write("SQL Command:" & sql_insertSeason)Response.Endin place of just abovecon.Execute sql_insertSeasonso you can see what the actual generated SQL command isKristen |
 |
|
|
|
|
|
|