0

Previously my C# app used this command to create an Excel file:

try
        {
            //SELECT INTO command                
            string cnStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + AccfilePath +
               ";Persist Security Info=False";

            ConnOpen(cnStr);

            using (connectionToDatabase)
            {
                //Give the Export Table (destination) a Name
                //baseTblName = dt.TableName;

                //Generate the SQL string to SELECT * INTO the NEW table in destination
                string selectcmd = "SELECT * INTO [Excel 12.0;Database=c:\\"+ExfilePath+"]." + tblName + " FROM " + tblName;


                using (OleDbCommand createCmd = new OleDbCommand(selectcmd, connectionToDatabase))
                {
                    createCmd.ExecuteNonQuery();
                }

                ConnClose();
            }


        }

I have moved to Win 7 64 bit and the OleDbCommand now gives me a "Failure Creating File". I have gone so far as to make the user an Administrator because I assumed it was a security issue.

cjjeeper
  • 93
  • 3
  • 4
  • 13

1 Answers1

0

There is no problem with this Oledb command. I have been fighting 64bit issues all day and assumed there was. My file path had incorrect syntax; after I fixed that it worked as expected.

cjjeeper
  • 93
  • 3
  • 4
  • 13