Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Namespace Does Not Exist

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

    Namespace Does Not Exist

    Hi,

    I installed a new packages in Visual Studio Editor, I dont see an error while compiling in Visual Studio but I get an error when I compile it in NinjaScript Editor. How do I add the new packages into my NinjaScript NameSpace so it will recognize it when compiling.

    I am trying to connect to my local Database using MS SQL Server, that is possible right?

    Thanks.
    Last edited by kezyclaire; 08-20-2023, 11:43 AM.

    #2
    Have you added the appropriate references to the
    MS SQL Server assemblies to NinjaTrader?

    See 'Adding a reference' here.

    Comment


      #3
      Hi bltdavid

      I was able to add the reference and now compiling successfully. The problem now is I am not able to connect successfully to my local database. Do you have any sample code or reference on how to connect to a SQL database to access data?

      Thanks.

      Comment


        #4
        Hello keyzclaire,

        Thanks for your notes.

        Connecting to a local SQL database would go beyond the support NinjaTrader's Support team would be able to provide you with.

        This forum thread will be open for other community members to share their insight on the topic.

        You could also consider researching the topic by doing Google searches such as 'How to connect to local SQL database C#' to find more information.
        <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

        Comment


          #5
          Originally posted by kezyclaire View Post
          Do you have any sample code or reference on how to connect to a SQL database to access data?
          Sorry, I do not.

          Google is your friend.

          Comment


            #6
            bltdavid, yeah, I am trying to use Dapper. It works using Windows Application App but not working when connecting with NinjaScript

            Comment


              #7
              Not working how?
              What error messages are you getting?

              Do you have a non-NinjaScript C# code example
              successfully connecting to this same database?

              Comment


                #8
                Does Dapper work with .NET Framework 4.8.1?

                Did you download the correct .NET version of Dapper?

                Comment


                  #9
                  bltdavid

                  Here is the error message. I have attached 2 screenshots, Windows Application Form is returning 3 rows while when running Ninja Script, it is already returning error when calling GetBarsPer in Class DataAccess. I am using the same statement, Database connection and Table in DataAccess Class, I just copy and paste. They are all the same from initializing and calling.

                  Dapper statement
                  result = connection.Query<BarsPeriodModel>("Select * From BarsPeriod Where Value = 0").ToList();
                  $exception {"Could not load file or assembly 'Dapper, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.":"Dapper, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"}
                  System.IO.FileNotFoundException
                  Click image for larger version  Name:	Running NinjaScript.jpg Views:	0 Size:	89.8 KB ID:	1265459
                  Click image for larger version  Name:	Windows Application Form.jpg Views:	0 Size:	144.7 KB ID:	1265460
                  Last edited by kezyclaire; 08-20-2023, 10:26 PM.

                  Comment


                    #10
                    Where is your 'Dapper.dll' file located?

                    Comment


                      #11
                      bltdavid I put in bin folder where ninjatrader was installed.

                      Comment


                        #12
                        I think it should be located here,
                        C:\Users\<username>\Documents\NinjaTrader 8\bin\Custom

                        Ask NT Support where it should go ...

                        Comment


                          #13
                          bltdavid I tried to read the log, it looks like it is looking for other dll, and then when I add the dll, other errors were occurring. Mostly about version errors. I think it is better to not be using dapper and other add ons and I will just go with simple sql connection. Thanks for your time ☺️

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by NullPointStrategies, Yesterday, 05:17 AM
                          0 responses
                          62 views
                          0 likes
                          Last Post NullPointStrategies  
                          Started by argusthome, 03-08-2026, 10:06 AM
                          0 responses
                          134 views
                          0 likes
                          Last Post argusthome  
                          Started by NabilKhattabi, 03-06-2026, 11:18 AM
                          0 responses
                          75 views
                          0 likes
                          Last Post NabilKhattabi  
                          Started by Deep42, 03-06-2026, 12:28 AM
                          0 responses
                          45 views
                          0 likes
                          Last Post Deep42
                          by Deep42
                           
                          Started by TheRealMorford, 03-05-2026, 06:15 PM
                          0 responses
                          50 views
                          0 likes
                          Last Post TheRealMorford  
                          Working...
                          X