miaomiaoga Posted September 1, 2005 Posted September 1, 2005 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. Quote
Administrators PlausiblyDamp Posted September 1, 2005 Administrators Posted September 1, 2005 What is the error it gives? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
miaomiaoga Posted September 2, 2005 Author Posted September 2, 2005 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. Quote
miaomiaoga Posted September 2, 2005 Author Posted September 2, 2005 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!! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.