<i><b>Originally posted by : Matt (dvdauthority@aol.com)</b></i><br /><br />I downloaded the Insert records code and it all "appears" to be working. I enter everything and it says "Your records have been updated" however when I got to check my database, the information is not there.<br /><br />Here's some info on my DB. My table and DB name are both "testing". My fields are (no quotes):<br />"column_one"<br />"column_two"<br />"column_three"<br />"column_four"<br />"link"<br />"image"<br /><br />Here's my .html code<br />====================<br /><br /><form method="post" name="form1" action="addrecords.asp"><br /><p><strong>Title</strong><br><br /><br /><input type="text" size="40" name="text1"><br><br /> <br /><strong>Author</strong><br><br /><input type="text" size="40" name="text2"><br><br /><br /><strong>Date added</strong><br><br /><input type="text" size="40" name="text"><br><br /><br /><strong>Type of Review</strong><br><br /><input type="text" size="40" name="text4"><br><br /><br /><strong>Link</strong><br><br /><input type="text" size="40" name="text5"><br><br /><br /><strong>Image location</strong><br><br /><input type="text" size="40" name="text6"><br><br /><br /><p><input type="Submit" value="Submit New Example" name"b1"> </font></p><br /></form><br /><br />Here's my .asp code<br />===================<br /><br /><%@ Language = "VBScript"%><br /><%<br />'Declare all local variables<br />dim conn<br />dim rs<br />'dim strconn<br />dim strsql<br />dim col1<br />dim col2<br />dim col3<br />dim col4<br />dim link<br />dim image<br /><br />strsql = ""<br />'set connection string to local variable-I use a DSN-less connection<br />'strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("testing.mdb")<br /><br />'build the sql statement based on the input from the form<br />strSQL = "INSERT INTO testing(column_one, column_two, column_three, column_four, link, image)"<br />strSQL = strSQL & " SELECT "<br />strSQL = strSQL & "'" & request("col1") & "' as text1," <br />strSQL = strSQL & "'" & request("col2") & "' as text2,"<br />strSQL = strSQL & "'" & request("col3") & "' as text3,"<br />strSQL = strSQL & "'" & request("col4") & "' as text4," <br />strSQL = strSQL & "'" & request("link") & "' as text5,"<br />strSQL = strSQL & "'" & request("image") & "' as text6,"<br /><br /><br />'Set connection object <br />Set con = Server.CreateObject("ADODB.Connection")<br />con.open "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=d:xxx.xx.xxx.xx esting.mdb"<br />'Use the execute method of the connection object the insert the record<br />'conn.execute(strSQL)<br />'conn.close<br />set conn = nothing<br />%><br /><html><head><br /><title>SQL Add record example</title><br /></head><br /><br /><body><br /><% = "Your record has been added" %><br /></body><br /></html><br /><br />if anyone can help figure this out, I'm forever grateful. Thanks so much in advance.<br /><br />-Matt<br /><br />
<i><b>Originally posted by : steve schofield</b></i><br />if this is the exact code you use the con.execute line is commented out. you actually have to execute your strsql statement.<br /><br />steve<br /><br /><br />------------<br />Matt at 3/17/2000 6:29:49 PM<br /><br /><br />I downloaded the Insert records code and it all "appears" to be working. I enter everything and it says "Your records have been updated" however when I got to check my database, the information is not there.<br /><br />Here's some info on my DB. My table and DB name are both "testing". My fields are (no quotes):<br />"column_one"<br />"column_two"<br />"column_three"<br />"column_four"<br />"link"<br />"image"<br /><br />Here's my .html code<br />====================<br /><br /><form method="post" name="form1" action="addrecords.asp"><br /><p><strong>Title</strong><br><br /><br /><input type="text" size="40" name="text1"><br><br /> <br /><strong>Author</strong><br><br /><input type="text" size="40" name="text2"><br><br /><br /><strong>Date added</strong><br><br /><input type="text" size="40" name="text"><br><br /><br /><strong>Type of Review</strong><br><br /><input type="text" size="40" name="text4"><br><br /><br /><strong>Link</strong><br><br /><input type="text" size="40" name="text5"><br><br /><br /><strong>Image location</strong><br><br /><input type="text" size="40" name="text6"><br><br /><br /><p><input type="Submit" value="Submit New Example" name"b1"> </font></p><br /></form><br /><br />Here's my .asp code<br />===================<br /><br /><%@ Language = "VBScript"%><br /><%<br />'Declare all local variables<br />dim conn<br />dim rs<br />'dim strconn<br />dim strsql<br />dim col1<br />dim col2<br />dim col3<br />dim col4<br />dim link<br />dim image<br /><br />strsql = ""<br />'set connection string to local variable-I use a DSN-less connection<br />'strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("testing.mdb")<br /><br />'build the sql statement based on the input from the form<br />strSQL = "INSERT INTO testing(column_one, column_two, column_three, column_four, link, image)"<br />strSQL = strSQL & " SELECT "<br />strSQL = strSQL & "'" & request("col1") & "' as text1," <br />strSQL = strSQL & "'" & request("col2") & "' as text2,"<br />strSQL = strSQL & "'" & request("col3") & "' as text3,"<br />strSQL = strSQL & "'" & request("col4") & "' as text4," <br />strSQL = strSQL & "'" & request("link") & "' as text5,"<br />strSQL = strSQL & "'" & request("image") & "' as text6,"<br /><br /><br />'Set connection object <br />Set con = Server.CreateObject("ADODB.Connection")<br />con.open "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=d:xxx.xx.xxx.xx esting.mdb"<br />'Use the execute method of the connection object the insert the record<br />'conn.execute(strSQL)<br />'conn.close<br />set conn = nothing<br />%><br /><html><head><br /><title>SQL Add record example</title><br /></head><br /><br /><body><br /><% = "Your record has been added" %><br /></body><br /></html><br /><br />if anyone can help figure this out, I'm forever grateful. Thanks so much in advance.<br /><br />-Matt<br /><br />
Was this answer helpful ?
Yes No