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

SQL INSERT INTO within a SSIS Script not working...please help!

$
0
0

Hello!

I am trying to insert data into a DB Table within a Script. Everything seems to work when I step through in the debugger however when it gets to the SQLCmd.ExecuteNonQuery() statement it bombs. Can you all please look at my simple code and suggest why it is not working within a SSIS Script Component. Thanks!! Mike

          cnn = new SqlConnection(connetionString);

            cnn.Open();
            cmd = new SqlCommand(sql, cnn);

           
            string sPath = "test";
            string sDescription = "test";
            string sMainOrExtra = "test";
            string sCaseID = "test";

            string insertString = @"insert into CodeParms(FileAndPathName, CASEID, MainOrExtr, [Desc])" +
           " VALUES (@sPath, @sDescription, @sMainOrExtra, @sCaseID)";

            using (var SQLCmd = new SqlCommand(insertString))
            {

            SQLCmd.Parameters.Add("@sPath", SqlDbType.Char).Value =  sPath;
            SQLCmd.Parameters.Add("@sCaseID", SqlDbType.Char).Value = sCaseID;
            SQLCmd.Parameters.Add("@sMainOrExtra", SqlDbType.Char).Value = sMainOrExtra;
            SQLCmd.Parameters.Add("@sDescription",SqlDbType.Char).Value =  sDescription;

            SQLCmd.ExecuteNonQuery(); //here is where it bombs!
            cnn.Close();


Mike Kiser


Viewing all articles
Browse latest Browse all 24688

Trending Articles



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