473,387 Members | 1,431 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,387 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 17 '05 #1
3 6782
Just curious, how would the AddParameter know @CustomerID is string?

Nov 17 '05 #2
Here is what I was reffering to

dbCommandWrapper.AddInParameter("@CategoryID", DbType.Int32, Category);

Nov 17 '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.

Thank you!!

Benny Ng
"DBC User" <db*****@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
Here is what I was reffering to

dbCommandWrapper.AddInParameter("@CategoryID", DbType.Int32, Category);

Nov 17 '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...
5
by: Andy | last post by:
Hi Could someone clarify for me the method parameter passing concept? As I understand it, if you pass a variable without the "ref" syntax then it gets passed as a copy. If you pass 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: 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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.