AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-04-12 : 09:01:32
|
malte writes "Can anybody help me please. I always have the same error.First ASP file works very good, but with the 2nd., I always get the same following error.Thankyou very much for your Help.Microsoft VBScript compilation error '800a0409' Unterminated string constant /admin_db_villas250.asp, line 8 connStr ="Provider=Microsoft.Jet.OLEDB.4.0;-------------------------------------------^__________________________________________________________ ' Declaring variables Dim refno, plot, built, area, bed, bath, price, description, data_source, con, sql_insert ' 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 refno = ChkString(Request.Form("refno")) plot = ChkString(Request.Form("plot")) built = ChkString(Request.Form("built")) area = ChkString(Request.Form("area")) bed = ChkString(Request.Form("bed")) bath = ChkString(Request.Form("bath")) price = ChkString(Request.Form("price")) description = ChkString(Request.Form("description")) data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _ Server.MapPath("simply_db1.mdb") sql_insert = "insert into villas250 (refno, plot, built, area, bed, bath, price, description) values ('" & _ refno & "', '" & plot & "', '" & built & "', '" & area & "', '" & bed & "', '" & bath & "', '" & price & "', '" & description & "')" ' Creating Connection Object and opening the database Set con = Server.CreateObject("ADODB.Connection") con.Open data_source con.Execute sql_insert ' Done. Close the connection con.Close Set con = Nothing __________________________________________________________---and here the one which does'nt work----------- ' Declaring variables Dim refno, plot, built, area, bed, bath, price, description, data_source, con ' Connection String ' Provide relative path to your StoredProc.mdb ' database Dim connStr connStr = "Provider=Microsoft.Jet.OLEDB.4.0; data_source=" & Server.MapPath("simply_db1.mdb") ' Connection Object Dim con Set con = Server.CreateObject("ADODB.Connection") ' connecting to database con.Open connStr ' executing stored procedure con.Execute "exec sq_input_villas250 'newrefno', 'newplot', 'newbuilt', 'newarea', 'newbed', 'newbath', 'newprice', 'newdescription'" ' closing connection and freeing resources con.Close Set con = Nothing " |
|