Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 26th, 2007, 04:14 PM
Authorized User
Join Date: Mar 2007
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to jgrant
Default Odbc Parameters Stored Procedure

Hi I am trying to execute a stored procedure and read the output values. I am getting a conversion error but I cannot figure out where its coming from. Here is the error:

Exception Details: System.Data.Odbc.OdbcException: ERROR [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Error converting data type nvarchar to int.

Source Error:

Line 39: conn.open()
Line 40:
Line 41: comm.ExecuteNonQuery()
Line 42:
Line 43: conn.close()

Here is the full source:

Dim comm as New ODBCCommand("{call jgrant_awcconnect..edit_equipment (?, ?, ?, ?, ?, ?)}", conn)
comm.parameters.add("@equipmentId", System.Data.SqlDbType.bigint)
comm.parameters("@equipmentId").Direction = ParameterDirection.Input
comm.parameters("@equipmentId").value = CInt(session("EquipmentId"))
comm.parameters.add("@Short", System.Data.SqlDbType.Nvarchar)
comm.parameters("@Short").Direction = ParameterDirection.Output
comm.parameters.add("@Long", System.Data.SqlDbType.Nvarchar)
comm.parameters("@Long").Direction = ParameterDirection.Output
comm.parameters.add("@Owned", System.Data.SqlDbType.Nvarchar)
comm.parameters("@Owned").Direction = ParameterDirection.Output
comm.parameters.add("@Job_Price", System.Data.SqlDbType.money)
comm.parameters("@Job_Price").Direction = ParameterDirection.Output
comm.parameters.add("@Job_Cost", System.Data.SqlDbType.money)
comm.parameters("@Job_Cost").Direction = ParameterDirection.Output


txtShort.text = comm.parameters("@short").value

Reply With Quote
  #2 (permalink)  
Old August 26th, 2007, 09:14 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts

This looks like a SQL syntax problem. This kind of error usually happens when you are have a type mismatch in SQL commands. It could be a conflict between two columns or a parameter and column. Please post the error message and the stored procedure code in the one the SQL Language or the appropriate SQL Server forum.

Reply With Quote
  #3 (permalink)  
Old August 26th, 2007, 10:21 PM
Authorized User
Join Date: Mar 2007
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to jgrant

yeah this is what I thought at first as well but I called the code within sql query analyzer and everything worked out. What I am wondering is whether I my call and parameter statements are correct. That is all I can think of that might be wrong.

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Stored Procedure Parameters Blank brettdalldorf Crystal Reports 0 September 20th, 2007 02:17 AM
One textbox, Two Parameters, with Stored Procedure GailCG Classic ASP Professional 0 March 3rd, 2006 03:39 PM
Calling Stored Procedure with parameters zarina_24 Classic ASP Professional 4 March 2nd, 2006 11:57 AM
stored procedure with parameters Danmalam VB Databases Basics 0 February 27th, 2005 03:52 PM
Calling stored procedure with output parameters bansalh SQL Server 2000 2 November 10th, 2004 11:00 AM

All times are GMT -4. The time now is 04:37 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.