本文介绍了从访问sql'无法找到可安装的ISAM'时,我收到了这样的错误。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我收到这样的错误'无法找到可安装的ISAM。'
复制访问db到sql db
我的代码是
I got an error like this 'Could not find installable ISAM.'
while copying access db to sql db
My code is
try
{
cn1 = new SqlConnection(con);
if (cn1.State != ConnectionState.Open) { cn1.Open(); }
cmd1 = new SqlCommand("Create database " + db + "");
cmd1.Connection = cn1;
cmd1.ExecuteNonQuery();
con += ";Driver=SQL Server;database='" + db + "'";
}
catch (Exception Ex) { }
try
{
DbProviderFactory factory = DbProviderFactories.GetFactory("System.Data.OleDb");
DataTable userTables = null;
using (connection)
{
string mappath = dataGridView1.CurrentRow.Cells["Path"].Value.ToString();
string[] filePaths = Directory.GetFiles(@"" + mappath + "", "*.mdb", SearchOption.TopDirectoryOnly);
// c:\test\test.mdb
foreach (string tr in filePaths)
{
connection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + tr + "";
string[] restrictions = new string[4];
restrictions[3] = "Table";
connection.Open();
userTables = connection.GetSchema("Tables", restrictions);
List<string> tableNames = new List<string>();
for (int i = 0; i < userTables.Rows.Count; i++)
tableNames.Add(userTables.Rows[i][2].ToString());
try
{
foreach (string tableName in tableNames)
{
OleDbCommand cmd = new OleDbCommand("select * into ["+con+"].["+tableName+"] from [" + tableName + "]"); // Got error Here
cmd.Connection = connection;
cmd.ExecuteNonQuery();
}
}
catch (Exception Ex) { connection.Close(); }
connection.Close();
}
}
}
catch (Exception Ex) { }
可以解决它吗
Can u pls resolve it
推荐答案
这篇关于从访问sql'无法找到可安装的ISAM'时,我收到了这样的错误。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!