Enterprise Library with Microsoft Access [modified]
-
Hi, How to pass parameters to a Access database using oledb provider and enterprise library. We used below code to update category table which has two colums ID and CategoryName. The code runs successfully without any errors but the table row remains unchanged. What could be the problem
Database db = DatabaseFactory.CreateDatabase("MyDemoConnection");
DbCommand dbCommand = db.GetSqlStringCommand("Update Category SET CategoryName = @CategoryName WHERE ID = @ID");
db.AddInParameter(dbCommand, "@ID", DbType.Int32,(int) 1);
db.AddInParameter(dbCommand, "@CategoryName", DbType.String, "Just a Change");// Execute command int i = db.ExecuteNonQuery(dbCommand);
<connectionStrings>
<add name="MyDemoConnection"
connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\db1.mdb;User Id=admin;Password=;"
providerName="System.Data.OleDb"/>
</connectionStrings>It would be great if any one can redirect me to the exact way
modified on Friday, August 21, 2009 7:21 AM
-
Hi, How to pass parameters to a Access database using oledb provider and enterprise library. We used below code to update category table which has two colums ID and CategoryName. The code runs successfully without any errors but the table row remains unchanged. What could be the problem
Database db = DatabaseFactory.CreateDatabase("MyDemoConnection");
DbCommand dbCommand = db.GetSqlStringCommand("Update Category SET CategoryName = @CategoryName WHERE ID = @ID");
db.AddInParameter(dbCommand, "@ID", DbType.Int32,(int) 1);
db.AddInParameter(dbCommand, "@CategoryName", DbType.String, "Just a Change");// Execute command int i = db.ExecuteNonQuery(dbCommand);
<connectionStrings>
<add name="MyDemoConnection"
connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\db1.mdb;User Id=admin;Password=;"
providerName="System.Data.OleDb"/>
</connectionStrings>It would be great if any one can redirect me to the exact way
modified on Friday, August 21, 2009 7:21 AM