PC Review


Reply
Thread Tools Rate Thread

Cryptic SQL Error 8178?

 
 
=?Utf-8?B?QnJpYW4gS2l0dA==?=
Guest
Posts: n/a
 
      3rd May 2005
Prepared statement '(@KeyNo int, @Key sql_variant) SELECT KeyNo, Key' expects
parameter @KeyNo, which was not supplied.

The following code snippet gives me the above error, what the heck does this
error mean? @KeyNo was supplied, what is it asking for?

SqlCommand mySelectCmd = new SqlCommand();
mySelectCmd.Connection = myConn;
mySelectCmd.Parameters.Add("@KeyNo", SqlDbType.Int, 10, "KeyNo");
mySelectCmd.Parameters.Add("@Key", SqlDbType.Variant, 255, "Key");
mySelectCmd.CommandText = "SELECT KeyNo, Key FROM KeyTable ";
SqlDataAdapter myDA = new SqlDataAdapter();
DataSet myDS = new DataSet();
myDA.SelectCommand = mySelectCmd;
myDA.Fill(myDS,"KeyTable");
 
Reply With Quote
 
 
 
 
=?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN
Guest
Posts: n/a
 
      4th May 2005
Nothing cryptic about it. You need to supply a value for the two parameters,
not merely a name. It is easier to see where the error is if you create the
parameters separate from adding them to the select query.


---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************

"Brian Kitt" wrote:

> Prepared statement '(@KeyNo int, @Key sql_variant) SELECT KeyNo, Key' expects
> parameter @KeyNo, which was not supplied.
>
> The following code snippet gives me the above error, what the heck does this
> error mean? @KeyNo was supplied, what is it asking for?
>
> SqlCommand mySelectCmd = new SqlCommand();
> mySelectCmd.Connection = myConn;
> mySelectCmd.Parameters.Add("@KeyNo", SqlDbType.Int, 10, "KeyNo");
> mySelectCmd.Parameters.Add("@Key", SqlDbType.Variant, 255, "Key");
> mySelectCmd.CommandText = "SELECT KeyNo, Key FROM KeyTable ";
> SqlDataAdapter myDA = new SqlDataAdapter();
> DataSet myDS = new DataSet();
> myDA.SelectCommand = mySelectCmd;
> myDA.Fill(myDS,"KeyTable");

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cryptic Error Message =?Utf-8?B?SlJH?= Windows Vista General Discussion 8 16th Aug 2007 05:49 AM
Cryptic compile error requeth@gmail.com Microsoft Access VBA Modules 6 24th Jan 2007 05:50 PM
Cryptic Error Message AD3875: Thread Creation Error Paul Knudsen Windows XP General 1 4th Apr 2005 07:55 AM
Cryptic error message Shabam Microsoft Dot NET 3 4th Feb 2005 01:19 AM
Cryptic error messages =?Utf-8?B?SEFSRFlY?= Windows XP Hardware 1 26th Dec 2003 11:08 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:13 PM.