J
Jack Black
Help!! I'm trying to call a custom stored procedure from a VB.Net
code-behind page in an ASP.Net application, and I keep getting an
error with no real helpful info...
Basically, I'm accepting a username and password from a front-end, and
performing a simple INSERT into a SQL Server table via a custom stored
procedure in the database. All privileges are fine, and the stored
procedure works fine (inserts records perfectly; tested with both ASP
and SQL's QueryAnalyzer), so SQL Server can be ruled out (I think) as
part of the issue.
Here is the code I'm using:
*************************************************
Sub storeUserAccount(ByVal strUsername As String, ByVal _
strPasswordHash As String, ByVal strSaltValue As String, ByVal _
strOffice As String, ByRef objData As _
System.Data.SqlClient.SqlConnection)
Dim objCommand As New SqlClient.SqlCommand("createUserAccount",
objData)
Dim objParameter As New SqlClient.SqlParameter
objParameter = objCommand.Parameters.Add("@userName",
SqlDbType.VarChar, 50)
objParameter.Value = strUsername
objParameter = objCommand.Parameters.Add("@passwordHash",
SqlDbType.VarChar, 1024)
objParameter.Value = strPasswordHash
objCommand.ExecuteNonQuery()
end sub
**************************************************
I know the data connection (OBJDATA) is open already because I perform
other functions before calling this method. The error being generated
(at the ExecuteNonQuery() method) is this:
Line 1: Incorrect syntax near createUserAccount.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Line 1:
Incorrect syntax near createUserAccount.
Help!! Any thoughts?
Jack
code-behind page in an ASP.Net application, and I keep getting an
error with no real helpful info...
Basically, I'm accepting a username and password from a front-end, and
performing a simple INSERT into a SQL Server table via a custom stored
procedure in the database. All privileges are fine, and the stored
procedure works fine (inserts records perfectly; tested with both ASP
and SQL's QueryAnalyzer), so SQL Server can be ruled out (I think) as
part of the issue.
Here is the code I'm using:
*************************************************
Sub storeUserAccount(ByVal strUsername As String, ByVal _
strPasswordHash As String, ByVal strSaltValue As String, ByVal _
strOffice As String, ByRef objData As _
System.Data.SqlClient.SqlConnection)
Dim objCommand As New SqlClient.SqlCommand("createUserAccount",
objData)
Dim objParameter As New SqlClient.SqlParameter
objParameter = objCommand.Parameters.Add("@userName",
SqlDbType.VarChar, 50)
objParameter.Value = strUsername
objParameter = objCommand.Parameters.Add("@passwordHash",
SqlDbType.VarChar, 1024)
objParameter.Value = strPasswordHash
objCommand.ExecuteNonQuery()
end sub
**************************************************
I know the data connection (OBJDATA) is open already because I perform
other functions before calling this method. The error being generated
(at the ExecuteNonQuery() method) is this:
Line 1: Incorrect syntax near createUserAccount.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Line 1:
Incorrect syntax near createUserAccount.
Help!! Any thoughts?
Jack