Hi Team,
Thanks for your effort. When am trying to execute below code it was throwing an exception must declare the variable @uname. Please trigger me where it was going wrong. thanks in advance.
<
Thanks for your effort. When am trying to execute below code it was throwing an exception must declare the variable @uname. Please trigger me where it was going wrong. thanks in advance.
<
Code:
Try con.Open() param = New SqlParameter() param.ParameterName = "@uname" param.Value = TextBox1.Text cmd.CommandType = CommandType.Text cmd.CommandText = "select * from student where fname=@uname" cmd.Parameters.Add(param) da = New SqlDataAdapter(cmd.CommandText, con) da.Fill(ds) DataGridView1.DataSource = ds.Tables(0) Catch ex As Exception MsgBox(ex.Message.ToString) End Try
Comment