I'm tring to insert to SQL server 2000 a data from a VB.net form. when i tried to run it , it says "Invalid object name 'Branch'." The code is found below: Help me pls!
Thank you.
Private Sub btnConnect_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConnect.Click
Dim fir As String
Dim sec As String
'Dim myCommand As SqlClient.SqlCommand = ""
'Dim ra As Integer
fir = TextBox1.Text
sec = TextBox2.Text
'Try
Dim strCNStr As String = "Data Source=ITSAD;User ID=sa;Password=;"
Dim cnDB As System.Data.SqlClient.SqlConnection = New System.Data.SqlClient.SqlConnection
Dim cmdDB As System.Data.SqlClient.SqlCommand = New System.Data.SqlClient.SqlCommand("Insert into Branch(Fname,Lname) VALUES ('& fir & ','& sec & ')", cnDB)
Dim rdAuther As System.Data.SqlClient.SqlDataReader
cnDB.ConnectionString = strCNStr
cnDB.Open()
'Catch ex As Exception
' MsgBox("Hi")
'End Try
rdAuther = cmdDB.ExecuteReader()
While rdAuther.Read()
Debug.WriteLine(rdAuther.GetString(1))
End While
rdAuther.Close()
cnDB.Close()
End Sub