How to used AddParameter method to add parameter?

miaomiaoga

Newcomer
Joined
Jan 28, 2005
Messages
7
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.
 
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 )

i saw the usage of AddParameter like this.But unfortunately i don't how to used this method in my code.

Can you help me?

Thanks.
 
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!!
 
Back
Top