VB.NET - Extracting data from Access 2003 - Asked By john on 11-Dec-10 11:46 AM

I have Access db backend with 2 tables, 1 stores UnitSize and Capacity, EG a Unit is 100 Sq.Ft and there are 10 of them. The second stores Units occupied. So I can have say 15 Units of 100SqFt. occupied and so on for other sizes. I need to produce a query of whats is occupied what is free and the balance.  Which in Access I've done and its works ok.  The question is do I leave the query and subqueries in Access or move them to the front end which is in VB.net 2005. I'm unsure what the best practice is.

TIA

Anoop S replied to john on 12-Dec-10 02:03 AM
There will be lot of tutorials available how to display data in front end using vb.net
for eg. here code for display data in a gridview from ms access database

using System;
using System.Data;
using System.Web.UI;
using System.Data.OleDb;
 
public partial class MSACCESSGV : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
 
if (!IsPostBack)
{
string sFilePath = Server.MapPath("MSACCESS.mdb");
DataTable dt;
OleDbConnection Conn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + sFilePath + ";");
 
using (Conn)
{
Conn.Open();
OleDbCommand cmd = new OleDbCommand("SELECT * FROM ARTICLE", Conn);
OleDbDataAdapter oDA = new OleDbDataAdapter(cmd);
dt = new DataTable();
oDA.Fill(dt);
}
 
gvArticle.DataSource = dt;
gvArticle.DataBind();
 
}
}
}


some tutorials
http://www.startvbdotnet.com/ado/msaccess.aspx
http://www.astahost.com/info.php/vbnet-ms-access-interaction-tutorial-part_t12054.html
http://vb.net-informations.com/ado.net-dataproviders/ado.net-oledbconnection.htm
 
john replied to Anoop S on 13-Dec-10 04:38 AM
Thank you for the info. I'll have a read see what problems I hit

regards