Biztalk 2006: Help with Scripting Functoid using SQL Query

Home Page Forums BizTalk 2004 – BizTalk 2010 Biztalk 2006: Help with Scripting Functoid using SQL Query

Viewing 1 reply thread
  • Author
    Posts
    • #14950

      Does anyone have a sample on how to successfully create an Inline C# – custom script to pull back a single record with a SQL script? Here’s my attempt and I’ve commented out everything except initilzing the Connection and simply return the value but it errors:

      Database is SQL Server 2005

      Error 1: The scripting functoid has no script type set, either external or inline, so proper code cannot be generated for it.

      NOTE: The script type is set to Inline C#.

      public string SQLDate(string strIn)
      {

      //ONLY TESTING THIS LINE FIRST – BUT GET ERROR.
      SqlConnection MyConnection = new SqlConnection(@\”Data
      Source=(local); Initial Catalog = SomeDB; Integrated
      Security=true\”);

      //PURPOSELY COMMENTED OUT THIS SECTION
      // SqlDataAdapter MyDataAdapter = new SqlDataAdapter(\”SELECT
      // * FROM myTable\”, MyConnection);

      //DataSet MyDataSet = new DataSet();

      //MyDataAdapter.Fill(MyDataSet, \”Patient\”);
      //DataTable myDataTable = MyDataSet.Tables[\”Patient\”];

      //foreach (DataRow myDataRow in myDataTable.Rows)
      //{
      // strIn= strIn + \”, \” + myDataRow[\”MedicalRec\”].ToString();

      //}

      //MyConnection.Close();

      return strIn;

      }

    • #14951

      I would put this code inside a .net component. That way, you can easily test the .net component and then add it to the map.

      Not sure if you can do this using inline SQL anyway. I’ve had such bad luck with them I do everything inside a .net component and just call it from the map.

      Hope this helps.

      • #14952

        I agree with Stephen, use an external C# assembly is much easier.

        You cannot use the [b:b2d6c400ec]using[/b:b2d6c400ec] directive in inline C#, so all external classes must be fully qualified:

        [code:1:b2d6c400ec]System.Data.SqlClient.SqlConnection MyConnection = new System.Data.SqlClient.SqlConnection(@\"Data Source=(local); Initial Catalog = SomeDB; Integrated Security=true\");[/code:1:b2d6c400ec]

Viewing 1 reply thread
  • The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.