By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,868 Members | 1,991 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,868 IT Pros & Developers. It's quick & easy.

Problem inserting auto id into my table

P: 1
I can't insert auto id into my table generating error on line 20:
Expand|Select|Wrap|Line Numbers
  1. <%
  2.   Option Explicit
  3.   dim cn 
  4.   Dim rs
  5.   Dim sq
  6.   Dim i
  7.  
  8.   Set cn = Server.CreateObject("ADODB.Connection")
  9.   Set rs = Server.CreateObject("ADODB.Recordset")
  10.   cn.Open "DSN=B;UID=;PWD=;Database=Goldenlife"
  11.  
  12. %>
  13.  
  14.  
  15. <%
  16.  
  17.  
  18.  For i=10001 To 99999
  19.  
  20.    If rs.BOF  Then
  21.  
  22.  
  23.       sq="insert into Test(id,code,Date"
  24.       sq=sq & " VALUES "
  25.       sq=sq & "('" & Request.Form("id") & "',"
  26.       sq=sq & "'" & Request.Form("C") & "',"
  27.       sq=sq & "'" & Request.Form("D") & "')"
  28.       cn.Execute sq,recaffected
  29.     Else
  30.  
  31.       Do While Not (rs.Eof)
  32.  
  33.       Loop
  34.     End If
  35.   next
  36. %>
Feb 24 '11 #1
Share this Question
Share on Google+
1 Reply


jhardman
Expert 2.5K+
P: 3,405
You shouldn't ever insert an auto-id. Skip that field and it should work.

Jared
Feb 24 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.