Cannot insert data into my database

Closed
share - Jun 13, 2010 at 11:05 PM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Jun 14, 2010 at 05:39 AM
Hello, what wrong with the coding~

Dim myConnection As SqlConnection
Dim myCommand As SqlCommand
Dim ra As Integer
myConnection = New SqlConnection("server=SHAYFEN-PC;uid=sa;pwd;database=shayfen")
myConnection.Open()
myCommand = New SqlCommand("Update User set user_register_login = 'sa'", myConnection)
ra = myCommand.ExecuteNonQuery()
'MessageBox.Show("New Row Inserted" & ra)
myConnection.Close()

Related:

1 response

rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Jun 14, 2010 at 05:39 AM
Dont you have to mention provider ?

I think connection string is not correct. It has been a while since I worked on SQL Server but i think it goes like

Provider=SQLOLEDB.1;User ID=sa;password=mypassword;Initial Catalog=shayfen;Data Source = SHAYFEN-PC;
1