<pre lang="vb">Dim strSQL As String Dim connection As SqlClient.SqlConnection = New SqlClient.SqlConnection("Data Source=ML0003135586;Integrated Security=SSPI;" & "Initial Catalog=TestSQL") strSQL = "SELECT * from tblTrainingPlan Where WHERE ([Category] = @Category)" connection.Open() Dim myCommand As SqlClient.SqlCommand = New SqlClient.SqlCommand(strSQL, connection) myCommand.Parameters.AddWithValue("@Category", 1) gee.DataSource = myCommand.ExecuteReader() gee.DataBind() connection.Close()
Incorrect syntax near the keyword 'WHERE'.
strSQL = "SELECT * from tblTrainingPlan Where WHERE ([Category] = @Category)"
strSQL = "SELECT * from tblTrainingPlan WHERE ([Category] = @Category)"
strSQL = "SELECT * from tblTrainingPlan Where WHERE [Category] = "'+@Category+'""
Dim strSQL As String Dim connection As SqlClient.SqlConnection = New SqlClient.SqlConnection("Data Source=ML0003135586;Integrated Security=SSPI;" & "Initial Catalog=TestSQL") strSQL = "SELECT * from tblTrainingPlan Where WHERE ([Category] = " + "1" + ")" connection.Open() Dim myCommand As SqlClient.SqlCommand = New SqlClient.SqlCommand(strSQL, connection) gee.DataSource = myCommand.ExecuteReader() gee.DataBind() connection.Close()
strSQL = "SELECT * from tblTrainingPlan Where WHERE [Category] = " + @Category
string strSQL = "(SELECT * from yourtable WHERE Category =" + @Category+ ")";
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)