curiousvbnet
Programmer
Hi,
I try to create parametered queries but i see error messages when i run them.
Here are these queries
this query is changed in
could you help me to improve this query to make it possible with parameters.
Thanks a lot for your help.
Regards
Nathalie
I try to create parametered queries but i see error messages when i run them.
Here are these queries
Code:
[red]Dim strSQL_recherche As String, obj_recherche As SqlCommand[/red]
strSQL_recherche = "select DISTINCT Lib_TERME as 'TERMES COMMENCANT PAR """ & txt_critere.Text.Trim.ToUpper & """ ' from TERMES where Lib_TERME like '" & txt_critere.Text.Trim & "%' order by Lib_TERME"
Code:
[blue] strSQL_recherche = "select DISTINCT Lib_TERME as 'TERMES COMMENCANT PAR ""' @txtcritere '""' from TERMES where Lib_TERME like @critere order by Lib_TERME"
obj_recherche = New SqlCommand(strSQL_recherche, objConn)
[/blue]
[green]obj_recherche.Parameters.Add(New SqlParameter("@txtcritere", txt_critere.Text.Trim.ToUpper))
obj_recherche.Parameters.Add(New SqlParameter("@critere", txt_critere.Text.Trim & "%"))[/green]
If objConn.State = ConnectionState.Closed then
objConn.Open()
End If
obj_recherche.ExecuteNonQuery()
could you help me to improve this query to make it possible with parameters.
Thanks a lot for your help.
Regards
Nathalie