|
-
Jul 3rd, 2003, 04:11 PM
#1
Thread Starter
Lively Member
Batch Inserts in MSACCESS
Try doing this in VB application
For intCounter = 1 To ClassInfos.Count
strSQL = strSQL & " Insert into Class(ClassID,ProgramID,StudentID) Values("
strSQL = strSQL & "'" & ClassInfos.Item(intCounter).ClassID & "','" & PInfo.ProgramID & "','" & SInfo.StudentID & "')" & vbCrLf
Debug.Print strSQL
Next intCounter
adoCmd.CommandText = strSQL
adoCmd.CommandType = adCmdText
adoCmd.Execute (intRecs)
Stupid MSACCESS dont accept batch inserts!! what the hell!!
Visual Basic Programmer.
VB,ASP,VBscript,JavaScript,Oracle,Developer 2000,ADO,HTML, C#, VB.NET, ASP.NET....
-
Jul 3rd, 2003, 04:40 PM
#2
Fanatic Member
I never tried doing a batch insert, but you can always just do an excute statement inside the for loop instead. But you would have to make sure your first assigment statement to strSQL doesn't include itself.
VB Code:
For intCounter = 1 To ClassInfos.Count
strSQL = " Insert into Class(ClassID,ProgramID,StudentID) Values("
strSQL = strSQL & "'" & ClassInfos.Item(intCounter).ClassID & "','" & PInfo.ProgramID & "','" & SInfo.StudentID & "')" & vbCrLf
adoCmd.Execute strSQL
Debug.Print strSQL
Next intCounter
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|