Hello
I have a simple SQL INSERT INTO statement so that I can add a record to a database.
The full code, including the INSERT INTO statement, reads as follows:
<%
Option Explicit
Dim ConnectionString
Dim connObj
Dim sql
Dim oRS
ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("\stevehigham\db\testDB.mdb" & ";" & _
"Persist Security Info=False"
Set ConnObj = Server.CreateObject("ADODB.Connection"
connObj.Open ConnectionString
sql = "select * from Table1"
sql = "SELECT girlSurname, girlFirst FROM Table1 ORDER BY girlSurname"
sql = "INSERT INTO Table1 VALUES (girlFirst, girlSurname)"
Set oRS = connObj.Execute(sql)
Do While Not oRS.EOF
Response.Write(oRS("girlFirst" & " - " & oRS("girlSurname" & "<br>"
oRS.MoveNext
Loop
oRS.Close
connObj.Close
Set oRS = Nothing
Set connObj = Nothing
%>
Now I suppose I need some HTML code so that the user can input a girl's first and surnames and send it to the database, but should I include this HTML code in the same .asp file as the above code, or is it best to create a new HTML file. If I create a new HTML file, how can the .asp file 'see' it?
Thank you for any help.
Best wishes
LaPluma
I have a simple SQL INSERT INTO statement so that I can add a record to a database.
The full code, including the INSERT INTO statement, reads as follows:
<%
Option Explicit
Dim ConnectionString
Dim connObj
Dim sql
Dim oRS
ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("\stevehigham\db\testDB.mdb" & ";" & _
"Persist Security Info=False"
Set ConnObj = Server.CreateObject("ADODB.Connection"
connObj.Open ConnectionString
sql = "select * from Table1"
sql = "SELECT girlSurname, girlFirst FROM Table1 ORDER BY girlSurname"
sql = "INSERT INTO Table1 VALUES (girlFirst, girlSurname)"
Set oRS = connObj.Execute(sql)
Do While Not oRS.EOF
Response.Write(oRS("girlFirst" & " - " & oRS("girlSurname" & "<br>"
oRS.MoveNext
Loop
oRS.Close
connObj.Close
Set oRS = Nothing
Set connObj = Nothing
%>
Now I suppose I need some HTML code so that the user can input a girl's first and surnames and send it to the database, but should I include this HTML code in the same .asp file as the above code, or is it best to create a new HTML file. If I create a new HTML file, how can the .asp file 'see' it?
Thank you for any help.
Best wishes
LaPluma