Click here to Skip to main content
16,019,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,
I m using C# windows program in Visual Studio 2005 with MS Access 2007 at run time I m getting error
oledb exception was unhandled error in vb.net ERROR CODE  -2147467259 

My code is below---
C#
private OleDbConnection conn = new OleDbConnection();
       private string constr = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + Application.StartupPath.ToString() + @"\TVSIO.mdb" + ";Persist Security Info=False;";

       public SelectStyNo()
       {
           InitializeComponent();
           try
           {
               conn = new OleDbConnection(constr);
               conn.Open();  ->here getting ERROR
           }
           catch (Exception ex)
           {
               MessageBox.Show(ex.Message);
           }

Thanks & Regards
Indrajit Dasgupta
Posted
Updated 5-Jan-12 17:51pm
v2

I think their is a problem with your connection string

check this link for various connection strings

http://www.connectionstrings.com/access[^]
 
Share this answer
 
Try this as your Private string constr
C#
private string constr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=@" + Application.StartupPath.ToString() + "\TVSIO.mdb;" + " Persist Security Info=False;";
 
Share this answer
 
v3
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900