|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Add data to MS Access table
Hello,
I wondering if anyone can help me with the following: I'm trying to read data from a table, do some calculations and then add the results to different table. The following is my ASP code which half is working as the calculated data are display on the user screen but my problem is that their not added to the other table. Here is my code: <html> <body> <% dim sql set conn = server.createobject("adodb.connection") set rs = server.createobject("adodb.recordset") conn.Provider = "Microsoft.Jet.OLEDB.4.0" conn.ConnectionString = "Data Source=" & Server.MapPath ("db/countryip.mdb") conn.open sql="Select * From qryipcountry" rs.open sql, conn, 2, 2 on error resume next while not rs.EOF with Response w = int ( rs("ipFROM") / 16777216 ) mod 256 x = int ( rs("ipFROM") / 65536 ) mod 256 y = int ( rs("ipFROM") / 256 ) mod 256 z = int ( rs("ipFROM") ) mod 256 dim finalIPfrom finalIPfrom = w & "." & x & "." & y & "." & z response.write "From IP: " &finalIPfrom wto = int ( rs("ipto") / 16777216 ) mod 256 xto = int ( rs("ipto") / 65536 ) mod 256 yto = int ( rs("ipto") / 256 ) mod 256 zto = int ( rs("ipto") ) mod 256 dim finalIPTo finalIPTo = wto & "." & xto & "." & yto & "." & zto response.write "To IP: " &finalIPTo dim sqladd set connadd = server.createobject("adodb.connection") set rsadd = server.createobject("adodb.recordset") connadd.Provider = "Microsoft.Jet.OLEDB.4.0" connadd.ConnectionString = "Data Source=" & Server.MapPath ("db/countryip.mdb") connadd.open sqladd="normalip" rsadd.open sqladd, connadd, 2, 2 rsadd.AddNew rsadd("startip")= finalipfrom rsadd("endip")= finalipTo rsadd("CountryName") = rs("countrySHORT") rsadd.Update rsadd.close %> <br> <% rs.MoveNext end with wend rs.close set rs = Nothing %> </body> </html> you can also see a result of this code using the following URL: http://80.0.7.205/andreas/iptest/nip2.asp Thanks in advance. |
|
#2
|
|||
|
|||
|
Sorry if i didn't explain well what my problem is.
Basicly the problem is the following part of my code that is not add ing the data to the table: sqladd="normalip" rsadd.open sqladd, connadd, 2, 2 rsadd.AddNew rsadd("startip")= finalipfrom rsadd("endip")= finalipTo rsadd("CountryName") = rs("countrySHORT") rsadd.Update rsadd.close %> set rs = Nothing %> Appriciate any help |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Add data to MS Access table |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|