Sigma248
04-03-2009, 09:25 PM
I am having a problem with the code below when trying to connect to an Access 2007 database from Visual Studio 2008 with ASP.NET VC# code.
protected void Button1_Click(object sender, EventArgs e)
{
OleDbConnection con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0; Data Source=\\Swantrax_2003.mdb; Persist Security Info=False;");
con.Open();
OleDbCommand cmd = new OleDbCommand("SELECT * From tParts where tParts.PartNo=CRUSHER", con);
OleDbDataAdapter myDA = new OleDbDataAdapter(cmd);
DataSet myDataSet = newDataSet();
myDA.Fill(myDataSet, "MyTable");
GridView1.DataBind();
con.Close();
}
Having problems getting the data to display in the webpage. It compiles with no errors but no data appears on webpage.
Any ideas?
protected void Button1_Click(object sender, EventArgs e)
{
OleDbConnection con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0; Data Source=\\Swantrax_2003.mdb; Persist Security Info=False;");
con.Open();
OleDbCommand cmd = new OleDbCommand("SELECT * From tParts where tParts.PartNo=CRUSHER", con);
OleDbDataAdapter myDA = new OleDbDataAdapter(cmd);
DataSet myDataSet = newDataSet();
myDA.Fill(myDataSet, "MyTable");
GridView1.DataBind();
con.Close();
}
Having problems getting the data to display in the webpage. It compiles with no errors but no data appears on webpage.
Any ideas?