Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem using DAAB ver 2. Error converting data type bigint to int

Status
Not open for further replies.

redgate

Programmer
Oct 15, 2001
29
0
0
GB
Hi

I am having the problem in a Web Application. In the mean time I created a windows app and used the following code.

XConnection()

Dim arParams(1) As SqlParameter

arParams(0) = New SqlParameter("@SESSIONID", TextBox1.Text)

arParams(1) = New SqlParameter("@CLIENTID", CLng(TextBox2.Text))

SqlHelper.ExecuteNonQuery(XConnection, CommandType.StoredProcedure, "SP_RECORD_LOGIN", arParams)

XConnection.Close()

This works prefectly. In my web app which references the same object I use the same code and get the error

Error converting data type bigint to int.
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: Error converting data type bigint to int.

Source Error:


Line 284:
Line 285: ' Finally, execute the command
Line 286: retval = cmd.ExecuteNonQuery()
Line 287:
Line 288: ' Detach the SqlParameters from the command object, so they can be used again

It must be something in the web app but the line reporting the error is in Microsoft.ApplicationBlocks.Data sqlhelper

Will battle on ......
 
I would assume the problem is on one of these two lines:
Code:
arParams(0) = New SqlParameter("@SESSIONID", TextBox1.Text)

arParams(1) = New SqlParameter("@CLIENTID", CLng(TextBox2.Text))

what are the data types of SessionID and ClientID in the database?

-Rick

----------------------
 
Hi

@SESSIONID IS NVARCHAR(50)
@CLIENTID IS INT

Remember the code above works from a windows forms enviroment but in my my web application. The Function ExecuteNonQuery is written to return an integer to a variable "retval" (also integer). All the stored proc does is a insert, not even return a value.

Still battling with this
 
I hold my head in shame. Stupid mistake on my side. Supplying the variables to the function in the wrong order is the cause of my problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top