I'm making a system by using Visual Studio Express 2012 and use the Microsoft SQL Server that already have in visual studio I think. My problem is, when i'm trying to run my system,an error occur said "Operator '&' is not defined for types 'String' and 'System.Windows.Forms.DataGridView'." This is my code.
Imports System.Data.SqlClient
Public Class Registration
Dim cn As New SqlConnection("Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\user_PC\Desktop\For FYP\Computer Lab Requirement System\FYP3\FYP3\FYP.mdf;Integrated Security=True")
Dim cmd As New SqlCommand
Dim dr As SqlDataReader
Private Sub Registration_Load(sender As Object, e As EventArgs) Handles MyBase.Load
cmd.Connection = cn
End Sub
Private Sub btnRegisterL_Click(sender As Object, e As EventArgs) Handles btnRegisterL.Click
If txtIDL.Text <> "" And txtUsernameL.Text <> "" And txtPasswordL.Text <> "" Then
cn.Open()
cmd.CommandText = "update info set id = '" & txtIDL.Text & "',user = '" & txtUsernameL.Text & "',pass = '" & txtPasswordL.Text & "'where id = '" & Form1.DataGridView1 & "' "
cmd.ExecuteNonQuery()
cn.Close()
txtIDL.Text = ""
txtUsernameL.Text = ""
txtPasswordL.Text = ""
End If
End Sub
End Class
I'm glad if there is some one could help me to explain and teach me about whats wrong with my coding above. I'm new in this thing. Thanks. :)