Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

Posted

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.

Posted

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!!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...