Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

Need help with OleDb in Script Task

$
0
0

I have been at this for hours now and cannot get it to work. I have searched and searched online and nothing I have found is helping. I am hoping that someone on here can help me out.

I am creating an SSIS package and am calling a Script Task to alter an existing Excel workbook. I have finally gotten the Script Task to get a green check in debug but it says that my Create Table syntax is not correct. Any ideas?

public void Main()
{
      string x = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Dts.Variables["User::DMTFolder"].Value.ToString() + ";Extended Properties=\"EXCEL 8.0; HDR = YES\"";
      string a = "CREATE TABLE DMTDataLoad (Company varchar(256), PartNum varchar(256), PartDescription varchar(256), ProdCode varchar(256));";

       using (OleDbConnection myConnection = new OleDbConnection(x))
            {
                OleDbCommand myCommand = new OleDbCommand(a,myConnection);
       
                try
                {
                    myConnection.Open();
                    myCommand.ExecuteNonQuery();
                }
                catch
                {
                }
            }
	Dts.TaskResult = (int)ScriptResults.Success;
}

Any help is greatly appreciated!!


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>