When i run the below code it was throwing an exception must declare the variable @uname. please help me to solve this issue.
Expand|Select|Wrap|Line Numbers
- Try
- con.Open()
- Dim param As New SqlParameter()
- param.ParameterName = "@uname"
- param.Value = TextBox1.Text
- cmd = New SqlCommand("select * from customer where custname=@uname", con)
- da = New SqlDataAdapter(cmd)
- da.Fill(ds)
- DataGridView1.DataSource = ds.Tables(0)
- Catch ex As Exception
- MsgBox(ex.Message.ToString)
- End Try
- con.Close()