从访问sql'无法找到可安装的ISAM'时,我收到了这样的错误。 [英] I got an error like this while copying from access to sql 'Could not find installable ISAM.'

查看:78
本文介绍了从访问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 &lt; 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

推荐答案

这个错误信息有很多原因。请检查以下内容:

- 您正在编译32位应用程序,而不是64位。

- 因为您遍历位置检查文件夹的名称是否有效,尤其是如果这适用于某些文件夹。
There are quite a few reasons for that error message. Check the following:
- you're compiling 32 bit application, not 64.
- since you loop through the locations check that the names of the folders are valid, especially if this works for some folders.


这篇关于从访问sql'无法找到可安装的ISAM'时,我收到了这样的错误。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆