Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Connecting to access

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

    Connecting to access

    Hej, hope you can help.
    I want to conect to an Access db, using oledb.(using System.Data.OleDb
    Is it possible from NT.

    Thanks in advance
    Crunchy

    #2
    Hello,

    I believe that this is beyond the level of support we provide, however I will have someone comfirm that on Monday.
    DenNinjaTrader Customer Service

    Comment


      #3
      Thank you, I am looking forward to it.

      Comment


        #4
        Crunchy,

        It is definitely possible. This thread describes using a MySQL db. The Access db will be very similar, just substitute in necessary DLL's...



        Mike

        Comment


          #5
          Thank you,
          I am not sure witch dll I should be looking for, but at least I have an idea.
          But if someone else have idea, then please let me know.
          thanks in advance
          Crunchy

          Comment


            #6
            Ok, I found "oledb.dll" on my system, but I found it in many places,
            so witsh one should I be using?
            feks. System.IO.Compression is identified from within the NT script.
            but where is it?.

            Thanks in advance
            Crunchy

            Comment


              #7
              I think I finaly got it after strugle.
              the system.data.oledb magicly appear in NT script inviroment, but where is the Dll, have no idea,
              what I did is uninstalling the all the Framework and installing Framework 3.5 SP1, then made a windows update.
              removed all cookies in my browser and reinstalled NT.
              Now I have a connection to a access

              Using system.data.oledb;

              OleDbConnection conn = null;
              OleDbDataReader reader =
              null;
              conn =
              new OleDbConnection(
              "Provider=Microsoft.Jet.OLEDB.4.0; " +
              "Data Source=C:/BlaBla/BlaBla.mdb");
              conn.Open();

              But Murphys lov says, that I first succed, after I installed Mysql DB, that I off course don't need now!
              Crunchy

              Comment


                #8
                Just an update for connection with OLEDB.
                I think it's only nesecary to install Framework 2, and then make a widows update. this code for inserting into an Access DB.


                string SQL = "INSERT INTO Table1 (test,test1)VALUES('s','s')";
                OleDbConnection conn =
                null;
                OleDbDataReader reader =
                null;

                conn =
                new OleDbConnection(
                "Provider=Microsoft.Jet.OLEDB.4.0; " +
                "Data Source=D:/Test/test.mdb");
                OleDbCommand command = null;
                command.CommandText = SQL;
                conn.Open();
                command.ExecuteNonQuery();
                conn.Close();

                Comment


                  #9
                  Originally posted by crunchy View Post
                  Just an update for connection with OLEDB.
                  I think it's only nesecary to install Framework 2, and then make a widows update. this code for inserting into an Access DB.


                  string SQL = "INSERT INTO Table1 (test,test1)VALUES('s','s')";
                  OleDbConnection conn =
                  null;
                  OleDbDataReader reader =
                  null;

                  conn =
                  new OleDbConnection(
                  "Provider=Microsoft.Jet.OLEDB.4.0; " +
                  "Data Source=D:/Test/test.mdb");
                  OleDbCommand command = null;
                  command.CommandText = SQL;
                  conn.Open();
                  command.ExecuteNonQuery();
                  conn.Close();
                  i am really interested in this, could you explain a basic how to do?

                  i don't know if while the ninja is running with datafeed if the data are real time tranfered from the 2 database?

                  Comment


                    #10
                    I am not shure that I understand your question, but this code is activated, when "onbarupdate" Method is called, in the NT script.

                    Crunchy

                    Comment


                      #11
                      Using system.data.oledb;

                      I can't make it work. As soon as I added "using System.Data.oledb;" and click compile in NT, I get the error "The type or namespace name Data does not exist in the namespace System". I have Framework 2.0 and I even tried it in a laptop with Framework 3 and it still did not work.

                      System.Data.Oledb is available in my computer. I know because I tried the following code in Visual Studio and it compiled clean.

                      ------------------------------------------------------
                      using System;
                      using System.Collections.Generic;
                      using System.ComponentModel;
                      using System.Data;
                      using System.Data.OleDb;
                      using System.Drawing;
                      using System.Text;
                      using System.Windows.Forms;
                      namespace MyTraderTest
                      {
                      publicpartialclassForm1 : Form
                      {
                      public Form1()
                      {
                      InitializeComponent();
                      String connect = "Provider=Microsoft.JET.OLEDB.4.0;data source=c:\\Program Files\\NinjaTrader 6.5\\db\\MyTrader.mdb";
                      OleDbConnection con = newOleDbConnection(connect);
                      con.Open();
                      Console.WriteLine("Made the connection to database");
                      con.Close();
                      }
                      }
                      }

                      ---------------------------------------------------

                      The problem is that within NT's Editor, the compile can not see System.Data.OleDb.

                      What else did you do to make yours work?

                      Help! Any help will be very much appreciated.

                      Ninja Support, will we be able to save data into a database in version 7?

                      Comment


                        #12
                        right click on any emtpy space in the editor, then choose "preference" or something like that, now you need to browse your pc, to find system.data.dll
                        I think that what I did, try it.
                        BR
                        Crunchy

                        Comment


                          #13
                          Originally posted by crunchy View Post
                          right click on any emtpy space in the editor, then choose "preference" or something like that
                          It's reference not preference, but close!

                          Mike

                          Comment


                            #14
                            It worked. Thanks so much.

                            Comment


                              #15
                              MS Access 2010 not working?

                              Hi
                              I had the same problem with system.data.dll and succesfully solved it with your description below, thanks.
                              I had to reference to the version 2.x of system.data.dll to make it work, with 4x it was not working. But now, when I want to open the database I get the error that it has the wrong database format. It is a new created database with 1 table. It is created with MS Access 2010, is this a problem? Can NT not access Access 2010 DB?

                              Any idea/help appreciated,
                              thanks
                              Andre

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              571 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              331 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              101 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              549 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              549 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X