Thursday, November 28, 2013

Problem to handle with Gridview

Hi,

I am running VS 2013 against Access 2013 DB. But due to that I'm calling this event


...
BindData();
...

private void BindData()
{
int iteid;
bool b = int.TryParse(lb_iteid.Text, out iteid);
DataTable table = new DataTable();
using (OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Jet OLEDB:Database Password=?????;Data Source=C:\inetpub\VS2012\DB1.accdb"))
{
string sql = "Select * from ite_tab2 where ite_id=@ite_id";
using (OleDbCommand cmd = new OleDbCommand(sql, conn))
{
//using (SqlDataAdapter ad = new SqlDataAdapter(cmd))
using (OleDbDataAdapter ad = new OleDbDataAdapter(cmd))
{
cmd.Parameters.Add("@ite_id", OleDbType.Integer).Value = iteid;
ad.Fill(table);
}
}
}
GridView1.DataSource = table;
GridView1.DataBind();
}



when saving the record, I've got this exception. why?

IErrorInfo.GetDescription failed with E_FAIL(0x80004005).System.Data



Many Thanks & Best Regards, Hua Min


No comments:

Post a Comment