Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Mar 07, 2013 05:19 AM by Amy Peng - MSFT
Member
1 Points
18 Posts
Feb 27, 2013 01:51 PM|LINK
Hi,
I have a stored procedure in my database (Sybase SQL Anywhere 12) that accepts a string, integer, and timestamp parameter declared like so:
procedureName( in @Text varchar(10), in @ID integer default null, in @WhenAdded timestamp default null )
I am trying to call this from my ASP.NET application using OleDB like so:
OleDbParameter paramText = new OleDBParameter("@Text", OleDBType.VarChar, 10); OleDbParameter paramID = new OleDBParameter("@ID", OleDBType.Integer); OleDbParameter paramWhenAdded = new OleDBParameter("@WhenAdded", OleDBType.DBTimestamp); paramText.Value = "Test"; paramID.Value = DBNull.Value; paramWhenAdded.Value = DateTime.Now;
I then use an sql statement like: CALL procedureName(?, ?, ?) with the parameters.
However, I am getting the following error:
System.Data.OleDb.OleDbException (0x80004005): Invalid parameter type
This is caused by the Timestamp parameter (if I remove it the error goes away). How should I be passing a timestamp value to a stored procedure?
Thanks,
Mike
Feb 27, 2013 03:41 PM|LINK
Well, that was stupid. I have two stored procedures and I didn't add the timestamp parameter on the second one (hence the error).
Star
11739 Points
1097 Posts
Microsoft
Mar 07, 2013 05:19 AM|LINK
Well Done!
It is kind of you to share your solution to us.
If you have any other problem, welcome to post it in the asp.net forums.
Best Regards, Amy Peng
mmount
Member
1 Points
18 Posts
Stored Procedure Timestamp Parameter = Invalid Parameter Type?
Feb 27, 2013 01:51 PM|LINK
Hi,
I have a stored procedure in my database (Sybase SQL Anywhere 12) that accepts a string, integer, and timestamp parameter declared like so:
procedureName( in @Text varchar(10), in @ID integer default null, in @WhenAdded timestamp default null )
I am trying to call this from my ASP.NET application using OleDB like so:
OleDbParameter paramText = new OleDBParameter("@Text", OleDBType.VarChar, 10); OleDbParameter paramID = new OleDBParameter("@ID", OleDBType.Integer); OleDbParameter paramWhenAdded = new OleDBParameter("@WhenAdded", OleDBType.DBTimestamp); paramText.Value = "Test"; paramID.Value = DBNull.Value; paramWhenAdded.Value = DateTime.Now;I then use an sql statement like: CALL procedureName(?, ?, ?) with the parameters.
However, I am getting the following error:
System.Data.OleDb.OleDbException (0x80004005): Invalid parameter type
This is caused by the Timestamp parameter (if I remove it the error goes away). How should I be passing a timestamp value to a stored procedure?
Thanks,
Mike
mmount
Member
1 Points
18 Posts
Re: Stored Procedure Timestamp Parameter = Invalid Parameter Type?
Feb 27, 2013 03:41 PM|LINK
Well, that was stupid. I have two stored procedures and I didn't add the timestamp parameter on the second one (hence the error).
Thanks,
Mike
Amy Peng - M...
Star
11739 Points
1097 Posts
Microsoft
Re: Stored Procedure Timestamp Parameter = Invalid Parameter Type?
Mar 07, 2013 05:19 AM|LINK
Hi,
Well Done!
It is kind of you to share your solution to us.
If you have any other problem, welcome to post it in the asp.net forums.
Best Regards, Amy Peng
Feedback to us
Develop and promote your apps in Windows Store