Private Sub validateplotno() Dim plotnumber As String = "" Using cnn As New SqlClient.SqlConnection("Data Source=toshiba-pc;Initial Catalog=VRINDAVAN;User ID=sa;password=zion123") Using cmd As SqlClient.SqlCommand = cnn.CreateCommand() cmd.CommandText = "SELECT 1 FROM plotmaster WHERE plotno = @plotno" cmd.Parameters.AddWithValue("@plotno", plotnumber) cnn.Open() Dim exists As String = cmd.ExecuteScalar().ToString()'here shows Object reference not set to an instance of an object."} If exists = "1" Then MessageBox.Show(plotnumber & " exists already.") End If End Using End Using End Sub
Using cmd As SqlClient.SqlCommand
Using cmd As New SqlClient.SqlCommand
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)