Adding Record

Results 1 to 2 of 2

Thread: Adding Record

  1. #1
    Join Date
    Dec 1969

    Default Adding Record

    Hi<BR><BR>I have an old Access database and I am extracting some data from it and putting it into my new sql server db, the best way form me to transfer the data I require was to write a quick script to do it. This script is below but I get an error saying:<BR><BR>Error Type:<BR>(0x80040E2F)<BR>/iwanthits2/transfer.asp, line 46<BR>This is the rs.Update line<BR><BR>Heres the code:<BR> <BR>Set conn2 = Server.CreateObject("adodb.connection")<BR>Set rs2 = Server.CreateObject("ADODB.Recordset")<BR><BR>strs ql2 = "SELECT * FROM thehitdetails"<BR> "meta" <BR> strsql2,conn2<BR><BR>aTable1Values = rs2.GetRows()<BR><BR>rs2.close<BR>set rs2 = nothing<BR>conn2.close<BR>set conn2 = nothing<BR><BR><BR> set rs = server.CreateObject("adodb.recordset")<BR> Set conn = Server.CreateObject("adodb.connection")<BR> strconnect <BR> "TheHitDetails", conn, adOpenKeyset, adLockOptimistic, adCmdTable<BR><BR><BR> for i = 0 to ubound(aTable1Values,2)<BR> rs.AddNew<BR> rs("infohitsID") = aTable1Values(0,i)<BR> rs("hitsID") = aTable1Values(1,i)<BR> rs("ipaddress") = aTable1Values(2,i)<BR> rs("browser") = aTable1Values(3,i)<BR> rs("browserversion") = aTable1Values(4,i)<BR> rs("theday") = aTable1Values(5,i)<BR> rs("themonth") = aTable1Values(6,i)<BR> rs("theyear") = aTable1Values(7,i)<BR> rs("thehour") = aTable1Values(8,i)<BR> rs("hitnumber") = aTable1Values(9,i)<BR> rs("refferers") = aTable1Values(10,i)<BR> rs("thedate") = aTable1Values(11,i)<BR> rs("thetime") = aTable1Values(12,i)<BR> rs("refengine") = aTable1Values(13,i)<BR> rs("keyword") = aTable1Values(14,i)<BR> rs("resolution") = aTable1Values(15,i)<BR> rs("colours") = aTable1Values(16,i)<BR> rs("operatsys") = aTable1Values(17,i)<BR> rs("country") = "UK"<BR> rs.Update<BR> next<BR><BR> rs.Close<BR> set rs = nothing<BR> <BR> conn.Close<BR> Set conn = nothing<BR><BR><BR><BR>Thanks

  2. #2
    Join Date
    Dec 1969

    Default RE: Adding Record

    Might be easier to run the DTS package in SQL Server... you have wizards that&#039;ll walk you through importing data from Access.<BR><BR>Or even do SELECT INTO.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts