Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0
OleDbConnectionStringBuilder sb = new OleDbConnectionStringBuilder();
sb.DataSource = sfd.FileName;//save file dialog filename is the datasource
sb.Provider = "Provider=Microsoft.Jet.OLEDB.4.0;";
sb.Add("Jet OLEDB:Database Password", "123456");
sb.PersistSecurityInfo = false;

bookConn = new OleDbConnection(sb.Provider + "@Data Source=" + sb.DataSource + ";" );
bookConn.Open();
oleDbCmd.Connection = bookConn;
 

 

I get an error Saying "could not find installable ISAM " at bookConn.Open
 
please help me
Posted 8-Jan-13 9:38am
Comments
richcb at 8-Jan-13 15:43pm
   
I don't think you need the "@" in front of the Data Source and you might try adding Extended Properties such as: bookConn = new OleDbConnection(sb.Provider + "Data Source=" + sb.DataSource + ";" + "Extended Properties= "Excel 8.0;");

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

The reason for this exception is because an error with connection string you prepare.
 
modify your connection string preparation like this
OleDbConnectionStringBuilder sb =  OleDbConnectionStringBuilder ();
sb.Add("Provider", "Microsoft.Jet.Oledb.4.0");
sb.Add("Jet OLEDB:Database Password", "*******");
sb.Add("Jet OLEDB:System Database",sfd.FileName);
bookConn = new OleDbConnection(sb.ConnectionString);
 
You can also refer here[^] to know more about connection string preparations. &
building-better-connectionstrings-with-connectionstringbuilder/[^]
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 553
1 CPallini 470
2 Sergey Alexandrovich Kryukov 418
3 George Jonsson 231
4 Afzaal Ahmad Zeeshan 194
0 OriginalGriff 5,370
1 CPallini 4,360
2 Sergey Alexandrovich Kryukov 3,822
3 George Jonsson 3,037
4 Gihan Liyanage 2,435


Advertise | Privacy | Mobile
Web04 | 2.8.140916.1 | Last Updated 8 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100