Database Connections

I have added this post now to demonstrate how to give a connection to a database first time from .net either in vb or c# for a windows based application

Open a windows application visual studio->File->New->Project, select the language as either c# or vb. click ok now. Drag a datagrid control to your form. now u can add a table by selecting the small arrow with the datagrid control and select the datasource.

Now the easiest way 

go to the code window , and type the following, 
Using a Oledbconnection---can connect to access database

oledbconnection cn
oledbcommand cmd

cn=new oledbconnection("foldername/dbsfilename")
cn.open()

cmd=new oledbcommand(cn,"yourquery")
cmd.executenonquery()-->for insert , update and delete query statements 
cmd.executescalar-->to retrieve a scalar value
cmd.executereader-->to return a recordset of rows or values.