T
Tony M
vs 2005 - vb .net - web forms - xp pro
Can't figure out why I keep getting the error Must declare the scalar
variable "@CheckUser".
The error happens on SqlDA.Fill(SqlDS). Just trying to make sure EMail
address doesn't exist in database before I insert data.
Connection string and everything else is correct. If I use Dim SQL = "Select
* from Clients where EMail = " & chr(39) & "(e-mail address removed)" &
chr(39) it works fine.
Dim parmIfExist As New SqlParameter("@CheckUser", txtEmail.Text)
SQL = "Select * from Clients where EMail = @CheckUser"
SqlCmd.CommandText = SQL
SqlCmd.Connection() = SQLcon
SqlCmd.Connection.Open()
SqlCmd.Parameters.Clear()
SqlCmd.Parameters.Add(parmIfExist)
Dim SqlDA As New SqlDataAdapter(SQL, SQLcon)
Dim SqlDS As New Data.DataSet()
Dim DR As Data.DataRow
SqlDA.Fill(SqlDS) << Error on this line Must declare the scalar variable
"@CheckUser".
If SqlDS.Tables(0).Rows.Count = 0 Then
Do stuff
end if
Thanks
Can't figure out why I keep getting the error Must declare the scalar
variable "@CheckUser".
The error happens on SqlDA.Fill(SqlDS). Just trying to make sure EMail
address doesn't exist in database before I insert data.
Connection string and everything else is correct. If I use Dim SQL = "Select
* from Clients where EMail = " & chr(39) & "(e-mail address removed)" &
chr(39) it works fine.
Dim parmIfExist As New SqlParameter("@CheckUser", txtEmail.Text)
SQL = "Select * from Clients where EMail = @CheckUser"
SqlCmd.CommandText = SQL
SqlCmd.Connection() = SQLcon
SqlCmd.Connection.Open()
SqlCmd.Parameters.Clear()
SqlCmd.Parameters.Add(parmIfExist)
Dim SqlDA As New SqlDataAdapter(SQL, SQLcon)
Dim SqlDS As New Data.DataSet()
Dim DR As Data.DataRow
SqlDA.Fill(SqlDS) << Error on this line Must declare the scalar variable
"@CheckUser".
If SqlDS.Tables(0).Rows.Count = 0 Then
Do stuff
end if
Thanks