473,379 Members | 1,544 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

errors with application data block

I have been using the MS Applicatin data block for over a year without
error. Recently, when calling ExecuteReader or ExecuteDataSet with a
parameterized stored procedure, I am receiving the following error:
Object must implement IConvertible. This only occurs when the procedure
expects parameters--procedures that don't take parameters work fine. The
error is coming from the data block. I am not dong anything any
different than I have for over a year of using the application data
blocks. A simplified code sample follows. Any clues as to why this is
suddenly happening? Anything I may not have checked? Thanks...

SqlDataReader drcheck=SqlHelper.ExecuteReader(
conn,"checklogin",
new SqlParameter("@un",username),
new SqlParameter("@pw",password));

ALTER PROCEDURE dbo.checkLogin
@un varchar(50),@pw varchar(50)
AS
SET NOCOUNT ON
select * from employees where email=@un and password=@pw
RETURN

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #1
2 1408
Phil,

The application data block comes with full source code. Have you tried
debugging it yourself? It shouldn't be too hard to pin down the error with
the source code.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Phil Townsend" <ph*******@yahoo.com> wrote in message
news:%2******************@TK2MSFTNGP14.phx.gbl...
I have been using the MS Applicatin data block for over a year without
error. Recently, when calling ExecuteReader or ExecuteDataSet with a
parameterized stored procedure, I am receiving the following error:
Object must implement IConvertible. This only occurs when the procedure
expects parameters--procedures that don't take parameters work fine. The
error is coming from the data block. I am not dong anything any
different than I have for over a year of using the application data
blocks. A simplified code sample follows. Any clues as to why this is
suddenly happening? Anything I may not have checked? Thanks...

SqlDataReader drcheck=SqlHelper.ExecuteReader(
conn,"checklogin",
new SqlParameter("@un",username),
new SqlParameter("@pw",password));

ALTER PROCEDURE dbo.checkLogin
@un varchar(50),@pw varchar(50)
AS
SET NOCOUNT ON
select * from employees where email=@un and password=@pw
RETURN

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 16 '05 #2
Hi Phil,

In this statement:
SqlDataReader drcheck=SqlHelper.ExecuteReader(
conn,"checklogin",
new SqlParameter("@un",username),
new SqlParameter("@pw",password));
how are the variables 'username' and 'password' declared? The constructor
for SqlParameter allows the second parameter to be declared as type Object
as long as that object implements IConvertible. If username and password
are not string objects, but are classes or some other object that doesn't
implement IConvertible, then you will get this error.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Phil Townsend" <ph*******@yahoo.com> wrote in message
news:%2******************@TK2MSFTNGP14.phx.gbl... I have been using the MS Applicatin data block for over a year without
error. Recently, when calling ExecuteReader or ExecuteDataSet with a
parameterized stored procedure, I am receiving the following error:
Object must implement IConvertible. This only occurs when the procedure
expects parameters--procedures that don't take parameters work fine. The
error is coming from the data block. I am not dong anything any
different than I have for over a year of using the application data
blocks. A simplified code sample follows. Any clues as to why this is
suddenly happening? Anything I may not have checked? Thanks...

SqlDataReader drcheck=SqlHelper.ExecuteReader(
conn,"checklogin",
new SqlParameter("@un",username),
new SqlParameter("@pw",password));

ALTER PROCEDURE dbo.checkLogin
@un varchar(50),@pw varchar(50)
AS
SET NOCOUNT ON
select * from employees where email=@un and password=@pw
RETURN

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Douglas Buchanan | last post by:
I am using the following code instead of a very lengthly select case statement. (I have a lot of lookup tables in a settings form that are selected from a ListBox. The data adapters are given a...
6
by: Shabam | last post by:
A web application of mine developed using C# + MS SQL runs fine normally. However when I stress test it with a load testing software (using about 60 simultaneous users) some instances start...
2
by: Sudip Chakraborty | last post by:
Is there a way to see constraint validation errors while loading xml into a DataSet ? I'm interested in the line number in the xml file which is causing the error. I've enclosed the relevant stack...
9
by: Jon LaBadie | last post by:
Suppose I'm using stdio calls to write to a disk file. One possible error condition is no space on file system or even (in unix environment) a ulimit of 0 bytes. Which calls would be expected to...
3
by: Phil Townsend | last post by:
In order to help alleviate connection pool errors, we have switched to the Microsoft Application blocks to help manange connections. Still, we are getting problems with connection pools reaching...
4
by: Phil Townsend | last post by:
While we have switched to the Application.Data block to improve connection management, we are still experiencing connection pool errors on occasions. I have been careful to explicitly close...
0
by: ad | last post by:
I have used Data Application Access Block2 in my web application. Now I download the Library Data Access Application Block. and read the document. May be I am stupid, I can't migrate it to...
1
by: Robert N | last post by:
I was able to compile (Debug) and reference an Configuration Block project for my primary application "AppPrimary.exe". When I add a strong name file to the Configuration Block project and...
1
by: Ersin Gençtürk | last post by:
We couldn't find why these errors happen.They doesn't appear everytime.And they appear different pages at different times.Is there somebody know why these happenes ? First user gets this error :...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.