ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 22nd, 2003, 12:32 PM
andreasg60 andreasg60 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 12 andreasg60 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #2  
Old October 23rd, 2003, 10:16 AM
andreasg60 andreasg60 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 12 andreasg60 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Add data to MS Access table


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT