Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Exception handling

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Exception handling

    I'm not sure if this is a ninja or a mysql issue:

    I tried to open a mysql connection by the official c# mysql connector demo code within the NinjaScript Initialize -method:

    MySql.Data.MySqlClient.MySqlConnection conn;

    string myConnectionString;

    myConnectionString = "server=127.0.0.1;uid=root;" +
    "pwd=12345;database=test;";

    try
    {
    conn = new MySql.Data.MySqlClient.MySqlConnection();
    conn.ConnectionString = myConnectionString;
    conn.Open();
    }
    catch (MySql.Data.MySqlClient.MySqlException ex)
    {
    Log(ex.Message);
    }


    Thereafter I got the Message in the Log-File, that Initialize failed, because "AssembyResolveEvent-Handler cannot return ReflectionOnly Assemblys".

    Can exception handling be used within Ninjascript?

    Best Regards

    Thomas

    #2
    Hello Thomas,
    NinjaScript is basically c# and you can use the try catch blocks for exception handling. Please refer to this sample code which further illustrates it.


    SQL is beyond what we can support buy you can refer to this thread which is in similar lines
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Hello Joydeep,

      thank you for your support. The error may be caused by a version conflict. I've installed several Net Versions. How can I find out which one is used by the Ninjascript compiler? In the "Assemby Reference" view are the names but no pathes to the system DLLs.

      Best Regards
      Thomas

      Comment


        #4
        Hello Thomas,
        NinjaTrader directs to the .Net Framework 3.5.

        A typical path will be like C:\Windows\Microsoft.NET\Framework64\v3.5\

        You can download the compatible .Net Framework version 3.5 from here
        JoydeepNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by gravdigaz6, Today, 11:40 PM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by MarianApalaghiei, Today, 10:49 PM
        3 responses
        10 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by XXtrader, Today, 11:30 PM
        0 responses
        4 views
        0 likes
        Last Post XXtrader  
        Started by love2code2trade, Yesterday, 01:45 PM
        4 responses
        28 views
        0 likes
        Last Post love2code2trade  
        Started by funk10101, Today, 09:43 PM
        0 responses
        9 views
        0 likes
        Last Post funk10101  
        Working...
        X