G
Guest
I found the following code on a website that works fine
Dim strSQL As Strin
strSQL = "Insert into Employees(lastname,firstname) values('Al','Coholic')
Dim objcommand As New SqlClient.SqlCommand(strSQL, New
SqlClient.SqlConnection("server=localhost;database=Northwind;uid=sa;pwd=;")
objcommand.Connection.Open(
objcommand.ExecuteNonQuery(
objcommand.Connection.Close(
objcommand.Dispose(
objcommand = Nothin
i want to do something similar but want to do multiple inserts within a loop - here is my code
Dim strSQL As Strin
strSQL = "Insert into Employees(lastname,firstname) values('Al','Coholic')
Dim objcommand As New SqlClient.SqlCommand(strSQL, New
SqlClient.SqlConnection("server=Sql-2;database=Northwind;uid=sa;pwd=;")
For x = 1 To
strSQL = "Insert into Employees(lastname,firstname) values('" & x & "','" & x & "')
objcommand.Connection.Open(
objcommand.ExecuteNonQuery(
objcommand.Connection.Close(
Nex
objcommand.Dispose(
objcommand = Nothin
i want to insert the values 1-5 for the first name and last name -- i am having a hard time finding and understanding what i am doing wrong - any help would be appreciated
Dim strSQL As Strin
strSQL = "Insert into Employees(lastname,firstname) values('Al','Coholic')
Dim objcommand As New SqlClient.SqlCommand(strSQL, New
SqlClient.SqlConnection("server=localhost;database=Northwind;uid=sa;pwd=;")
objcommand.Connection.Open(
objcommand.ExecuteNonQuery(
objcommand.Connection.Close(
objcommand.Dispose(
objcommand = Nothin
i want to do something similar but want to do multiple inserts within a loop - here is my code
Dim strSQL As Strin
strSQL = "Insert into Employees(lastname,firstname) values('Al','Coholic')
Dim objcommand As New SqlClient.SqlCommand(strSQL, New
SqlClient.SqlConnection("server=Sql-2;database=Northwind;uid=sa;pwd=;")
For x = 1 To
strSQL = "Insert into Employees(lastname,firstname) values('" & x & "','" & x & "')
objcommand.Connection.Open(
objcommand.ExecuteNonQuery(
objcommand.Connection.Close(
Nex
objcommand.Dispose(
objcommand = Nothin
i want to insert the values 1-5 for the first name and last name -- i am having a hard time finding and understanding what i am doing wrong - any help would be appreciated