473,320 Members | 1,952 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,320 software developers and data experts.

How to used AddParameter method to add parameter?

Now I'm used MS Enterprise Library to insert data into DataGrid.

But an statement error in AddParameter in the following:

Database db = DatabaseFactory.CreateDatabase("Database Instance NorthWind");
string sqlCommand = "Select CustomerID, CompanyName, ContactName From
Customers";
DBCommandWrapper dbCommandWrapper =
db.GetSqlStringCommandWrapper(sqlCommand);
//dbCommandWrapper.AddParameter("@CustomerID","FRANK ") ; <--Error

But how to used this method? seems many parameter should be insert into
this. in this case, i want to search the datas where CustomerID="FRANK", and
return it.

How to solve it?

Any suggestion are appreciated. Thanks.
Nov 19 '05 #1
3 9760
Ben
Benny,

The AddParameter method of the DBCommandWrapper doesn't have an overload
that takes only two parameters.

You'll need to provide a match to one of the two overloads for AddParameter.
string name, DbType dbType, ParameterDirection direction,
string sourceColumn, DataRowVersion sourceVersion, object value

or

string name, DbType dbType, int size, ParameterDirection direction,
bool nullable, byte precision, byte scale, string sourceColumn,
DataRowVersion sourceVersion, object value

HTH,
Ben

"Benny Ng" <be**********@hotmail.com> wrote in message
news:eo*************@tk2msftngp13.phx.gbl...
Now I'm used MS Enterprise Library to insert data into DataGrid.

But an statement error in AddParameter in the following:

Database db = DatabaseFactory.CreateDatabase("Database Instance
NorthWind");
string sqlCommand = "Select CustomerID, CompanyName, ContactName From
Customers";
DBCommandWrapper dbCommandWrapper =
db.GetSqlStringCommandWrapper(sqlCommand);
//dbCommandWrapper.AddParameter("@CustomerID","FRANK ") ; <--Error

But how to used this method? seems many parameter should be insert into
this. in this case, i want to search the datas where CustomerID="FRANK",
and return it.

How to solve it?

Any suggestion are appreciated. Thanks.

Nov 19 '05 #2
Yes,Thanks first.

I just found the usage of this method. But unfortunately I don't know how to
full fill all parameters into this statement. So, any sample can give helps
me?

public abstract new void AddParameter ( System.String name ,
System.Data.DbType dbType , System.Data.ParameterDirection direction ,
System.String sourceColumn , System.Data.DataRowVersion sourceVersion ,
System.Object value )
"Ben" <be*@online.nospam> wrote in message
news:f3**************************@FUSE.NET...
Benny,

The AddParameter method of the DBCommandWrapper doesn't have an overload
that takes only two parameters.

You'll need to provide a match to one of the two overloads for
AddParameter.
string name, DbType dbType, ParameterDirection direction,
string sourceColumn, DataRowVersion sourceVersion, object value

or

string name, DbType dbType, int size, ParameterDirection direction,
bool nullable, byte precision, byte scale, string sourceColumn,
DataRowVersion sourceVersion, object value

HTH,
Ben

"Benny Ng" <be**********@hotmail.com> wrote in message
news:eo*************@tk2msftngp13.phx.gbl...
Now I'm used MS Enterprise Library to insert data into DataGrid.

But an statement error in AddParameter in the following:

Database db = DatabaseFactory.CreateDatabase("Database Instance
NorthWind");
string sqlCommand = "Select CustomerID, CompanyName, ContactName From
Customers";
DBCommandWrapper dbCommandWrapper =
db.GetSqlStringCommandWrapper(sqlCommand);
//dbCommandWrapper.AddParameter("@CustomerID","FRANK ") ; <--Error

But how to used this method? seems many parameter should be insert into
this. in this case, i want to search the datas where CustomerID="FRANK",
and return it.

How to solve it?

Any suggestion are appreciated. Thanks.


Nov 19 '05 #3
Oh,Yes!

Problem solved!

At first, I misunderstand that the AddInParameter is only for
StoreProcedure. But just now when I try to used this for run SQL statement.
Successed it.

Use AddInParameter, Not AddParameter.(maybe AddParameter also can,But
actually haven't enough time to try it).

Thank you!!

Benny Ng

"Ben" <be*@online.nospam> wrote in message
news:f3**************************@FUSE.NET...
Benny,

The AddParameter method of the DBCommandWrapper doesn't have an overload
that takes only two parameters.

You'll need to provide a match to one of the two overloads for
AddParameter.
string name, DbType dbType, ParameterDirection direction,
string sourceColumn, DataRowVersion sourceVersion, object value

or

string name, DbType dbType, int size, ParameterDirection direction,
bool nullable, byte precision, byte scale, string sourceColumn,
DataRowVersion sourceVersion, object value

HTH,
Ben

"Benny Ng" <be**********@hotmail.com> wrote in message
news:eo*************@tk2msftngp13.phx.gbl...
Now I'm used MS Enterprise Library to insert data into DataGrid.

But an statement error in AddParameter in the following:

Database db = DatabaseFactory.CreateDatabase("Database Instance
NorthWind");
string sqlCommand = "Select CustomerID, CompanyName, ContactName From
Customers";
DBCommandWrapper dbCommandWrapper =
db.GetSqlStringCommandWrapper(sqlCommand);
//dbCommandWrapper.AddParameter("@CustomerID","FRANK ") ; <--Error

But how to used this method? seems many parameter should be insert into
this. in this case, i want to search the datas where CustomerID="FRANK",
and return it.

How to solve it?

Any suggestion are appreciated. Thanks.


Nov 19 '05 #4

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

Similar topics

12
by: Mark Constant | last post by:
I have a drop-down list now and I got it so when something is selected from the drop down list it calls a JavaScript function. I want it so the value selected from the drop-down list is sent as a...
15
by: pranab_bajpai | last post by:
So I want to define a method that takes a "boolean" in a module, eg. def getDBName(l2): .... Now, in Python variables are bound to types when used, right? Eg. x = 10 # makes it an INT...
6
by: Efim | last post by:
Hi all, Due to performance issue, I want to pevent execution of ToString() function in the code like the following: if(reporting_level & DEBUG_LEVEL) log(reporting_level,string.Format("Event of...
0
by: David Veeneman | last post by:
This post is for the Google archive and does not require a reply. I received an 'Invalid parameter used' error when trying to do double-buffering with the .Net SetStyles method. I used this code...
3
by: Benny Ng | last post by:
Now I'm used MS Enterprise Library to insert data into DataGrid. But an statement error in AddParameter in the following: Database db = DatabaseFactory.CreateDatabase("Database Instance...
4
by: escristian | last post by:
Hello. I'm trying to create an Image so I use something like this: Image newImage = Image.FromFile(filename); Now when it's a bmp file and certain .gif files it gives me an exception that...
0
by: Xah Lee | last post by:
In this article, i explain how the use of bit masks is a hack in many imperative languages. Often, a function will need to take many True/False parameters. For example, suppose i have a function...
4
by: Ed | last post by:
Hi, dear all, Here are some questions when I was writing CLI code, which would be used by C# Project. 1. Reference Parameter If CLI method have % reference type parameter, which is ref class,...
4
by: Andrus | last post by:
I tried to use type parameter to call static method but got compile error 'T' is a 'type parameter', which is not valid in the given context. Why this is not allowed ? Should I really use a lot...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.