Ok. This is my first time working with SQL Server. I was under the impression that using a SQL Connection that you dont need a provider for it. But i get this error.
An OLE DB Provider was not specified in the ConnectionString. An example would be, Provider=SQLOLEDB;.
So why does it do that.
Oops.. I think Im ok.. I forgot about the command object and executing non querys.
An OLE DB Provider was not specified in the ConnectionString. An example would be, Provider=SQLOLEDB;.
So why does it do that.
Code:
Dim da As OleDb.OleDbDataAdapter
Dim oSQLConn As SqlConnection = New SqlConnection
oSQLConn.ConnectionString = "Data Source=(local);" & _
"Initial Catalog=dbCustomers;" & _
"Integrated Security=SSPI"
Dim myCustomer As New CCustomer
With myCustomer
.FirstName = txtFirstName.Text
.LastName = txtLastName.Text
.City = txtCity.Text
.ZipCode = txtZipCode.Text
.Country = txtCountry.Text
End With
Dim SQL As String = "INSERT INTO dbCustomers.tblCustomers (CustomerID, FirstName, LastName, Address, City, ZipCode, Country) VALUES (" _
& "" & myCustomer.FirstName & "" & " ," & "" & myCustomer.LastName & "" & " ," & "" _
& myCustomer.Address & "" & " ," & "" & myCustomer.City & "" & " ," & "" & myCustomer.ZipCode & "" & " ," & "" & myCustomer.Country & "" & ")"
da = New OleDb.OleDbDataAdapter(SQL, oSQLConn.ConnectionString)
Oops.. I think Im ok.. I forgot about the command object and executing non querys.
Last edited by a moderator: