P
Pim75
Hello,
I want to store multiple records at once in a SQL database with a
For..Next instruction like the sample code below:
For counter = 0 To 100
Dim dbInsert As New SqlCommand( _
"INSERT INTO table (Field1, Field2) VALUES ('" & Field1 & "', '" &
Field2 & "')", _
myConnection)
dbInsert.Connection.Open()
dbInsert.ExecuteNonQuery()
dbInsert.Connection.Close()
Next
In the code above the query to add the record to the database is
executed 100 times. I would like to know if there's a more efficient
way to add 100 records at once to the table?
Any help is appreciated!
I want to store multiple records at once in a SQL database with a
For..Next instruction like the sample code below:
For counter = 0 To 100
Dim dbInsert As New SqlCommand( _
"INSERT INTO table (Field1, Field2) VALUES ('" & Field1 & "', '" &
Field2 & "')", _
myConnection)
dbInsert.Connection.Open()
dbInsert.ExecuteNonQuery()
dbInsert.Connection.Close()
Next
In the code above the query to add the record to the database is
executed 100 times. I would like to know if there's a more efficient
way to add 100 records at once to the table?
Any help is appreciated!