Here is my question: I have created an MS Access database and I am trying to create a connection using VB2005
Thanks
J
Here is my question: I have created an MS Access database and I am trying to create a connection using VB2005
Thanks
J
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
theo philus25 reputationPosted Jan 20, 2009, 11:33 AM EST
OleDbConnection conn=new OleDbConnection(@"Provider=Microsoft.Jet.OleDb.4.0;Data Source=C:\students.mdb");
conn.Open();
OleDbCommand cmd=new OleDbCommand();
conn.Connection=conn;
conn.CommandText=String.Format("Select * from Students");
OleDbDataAdapter adp=new OleDbDataAdapter(cmd);
int temp=cmd.ExecuteNonQuery();
if(temp>0)
{
MessageBox.Show("Records Selected");
}
else
{
MessageBox.Show("Records Not Selected");
}
From SIAMEH THEOPHILUS UNIVERSITY OF GHANA,LEGON-----00233 243559227
Sriram Ramani144 reputationPosted Jan 31, 2009, 4:13 AM EST
All u need is first select add new database and select the MS.Access database and load ur file and table..
then u must add a connection
first include the "import system.data.oledb" namespace....
then include this code:
Dim
a As String Public cn As OleDbConnection Public cmd As OleDbCommand Public dr As OleDbDataReader Public Sub conn()a =
"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Bday pro database\bday.accdb" ---"bday" name of ur filecn =
New OleDbConnection(a)cn.Open()
End SubVijaya KadiyalaRank #1,085 · 1.8K reputationPosted Feb 9, 2009, 7:37 AM EST
Hi Check out the below link
http://www.astahost.com/info.php/vb-net-ms-access-interaction-tutorial-part_t12054.html
Thanks
-- Vijaya Kadiyalahttp
://dotnetvj.blogspot.com