A
Andy G
I am getting an error when I try to call my stored procedure. Exception
adding account. Procedure 'stpCFSPH_CM_RGST_USER' expects parameter
'@USER_DESCR', which was not supplied.
I have a radio button list w/ two items, Student w/ a value of 2 and
PrivUser w/ a value of 3. What I do on the click 'Submit' button is set all
of the variables and pass them to my Admin class. Below is specifically
what I define for the userRole (what I am getting the error on)
Dim userRole As Integer = radUserList.SelectedItem.Value
Admin.StoreAccountDetails(txtUserName.Text, passwordHash, salt, tempAnswer,
qstn, userRole)
Here is my Admin.StoreAccountDetails code:
Dim conn As SqlConnection = New SqlConnection(GetConn.GetCnxString())
Dim cmd As SqlCommand = New SqlCommand("stpCFSPH_CM_RGST_USER", conn)
cmd.CommandType = CommandType.StoredProcedure
Dim sqlParam As SqlParameter = Nothing
[ALL OF THE OTHER PARAMS GO HERE, LEFT OUT FOR CLARITY]
sqlParam = cmd.Parameters.Add("@USER_DESCR", SqlDbType.Int, 10)
sqlParam.Value = userDescr
Try
conn.Open()
cmd.ExecuteNonQuery()
Catch ex As Exception
' Code to check for primary key violation (duplicate account name)
' or other database errors omitted for clarity
Throw New Exception("Exception adding account. " + ex.Message)
Finally
conn.Close()
End Try
adding account. Procedure 'stpCFSPH_CM_RGST_USER' expects parameter
'@USER_DESCR', which was not supplied.
I have a radio button list w/ two items, Student w/ a value of 2 and
PrivUser w/ a value of 3. What I do on the click 'Submit' button is set all
of the variables and pass them to my Admin class. Below is specifically
what I define for the userRole (what I am getting the error on)
Dim userRole As Integer = radUserList.SelectedItem.Value
Admin.StoreAccountDetails(txtUserName.Text, passwordHash, salt, tempAnswer,
qstn, userRole)
Here is my Admin.StoreAccountDetails code:
Dim conn As SqlConnection = New SqlConnection(GetConn.GetCnxString())
Dim cmd As SqlCommand = New SqlCommand("stpCFSPH_CM_RGST_USER", conn)
cmd.CommandType = CommandType.StoredProcedure
Dim sqlParam As SqlParameter = Nothing
[ALL OF THE OTHER PARAMS GO HERE, LEFT OUT FOR CLARITY]
sqlParam = cmd.Parameters.Add("@USER_DESCR", SqlDbType.Int, 10)
sqlParam.Value = userDescr
Try
conn.Open()
cmd.ExecuteNonQuery()
Catch ex As Exception
' Code to check for primary key violation (duplicate account name)
' or other database errors omitted for clarity
Throw New Exception("Exception adding account. " + ex.Message)
Finally
conn.Close()
End Try