|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
i have a .html file shown below. I just want to get the value from the variable
and insert that to by access database. Can you please tell me how to get the value in the variable 'nam' in dbcheck() method. i feel the problems are in the red lines highlighted below in my code. the html code: <html> <head> <title>test jscript</title> <SCRIPT LANGUAGE="JavaScript" RUNAT="server"> <!-- function dbcheck() { ADOConn = new ActiveXObject("ADODB.Connection"); strConn = ""; strConn += "driver={Microsoft Access Driver (*.mdb)};"; strConn += "dbq=c:\\Inetpub\\wwwroot\\cctemp\\db2.mdb;"; ADOConn.Open(strConn); nam= document.req.textbox.value; sql="insert into tbl_name (name) values (' "&nam&" ')"; ADOConn.Execute(sql); } //--> </SCRIPT> </head> <body> <form name="req"> <p><input type=button value="add to db" onclick="dbcheck()"></p> <p><input type=text name="textbox"></p> </form> </body> </html> |
|
#2
|
||||
|
||||
|
The semicolon does not belong OUTSIDE of the quotation, in fact you can delete it altogether. Secondly nam must contain a legal value (correct data type and length to fit into the table) and can only contain one value, not be an array of values.
You should provide the error message when posting so we know what your problem is. |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft SQL Server > sql INSERT help: how to INSERT from a variable? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|