Results 1 to 6 of 6

Thread: Ado.Net -> ADODB Help!

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2002
    Posts
    100

    Ado.Net -> ADODB Help!

    Please help! I'm very confused on this, the following is my code that I am using to attempt to connect to a mysql database, any help will be apreciated!

    string dbConn = "driver={mysql};server=193.169.0.3;database=StealthOnline_Com;user=;password=;";

    ADODB._Connection db = new ADODB.ConnectionClass();
    ADODB._Recordset rs = new ADODB.RecordsetClass();



    db.Open(dbConn, "", "", -1);


    rs.Open("select * from sfx", db, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, -1);


    How do I now grab the data from the recordset? this is my problem!

    Thanks in advance,
    toto

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Sep 2002
    Posts
    100
    Hello again!

    This is my code now, I managed to read all the data into a datagrid by passing the information from the adodb recordset into a dataset and then into the data grid.

    I'm still having trouble reading the recordset directly, I figured out one of my problems and that was RS.Fields[] instead of RS.Fields(). However the information comes out as "ADODB.InternalField".


    string dbConn = "driver={mysql};server=193.169.0.3;database=;user=;password=;";

    ADODB._Connection db = new ADODB.ConnectionClass();
    ADODB._Recordset rs = new ADODB.RecordsetClass();

    db.Open(dbConn, "", "", -1);
    rs.Open("select * from sfx", db, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, -1);

    this.Text = rs.Fields["mapname"].ToString();

    DataSet ds = new DataSet();

    System.Data.OleDb.OleDbDataAdapter dataAdapter = new System.Data.OleDb.OleDbDataAdapter();
    dataAdapter.Fill(ds, rs, "sfx");

    dataGrid1.DataSource = ds.Tables["sfx"].DefaultView;

    Please help! Thanks!
    -toto

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Sep 2002
    Posts
    100
    Dear Friends please help me, I am in need of a solution asap! If there is another way to connect to mysql please suggest it!

    Thank You,
    -toto

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Sep 2002
    Posts
    100
    Ah well, I happened to stumble upon the solution by tediously trying every single property of the Recordset...

    For future refrence I used:

    RecordSet.get_Collet("field").ToString()


    Thanks anyways,
    -toto



    p.s. I'm sure there is a better way to do this, if anyone knows please let me know!!!

  5. #5
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Yeah there is a better way. You could use ADO .NET. You are just using the Com Interop wrapper around the adodb control. Also there is no such thing as recordsets anymore. That is what the DataSet is for.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  6. #6
    Frenzied Member
    Join Date
    May 2002
    Posts
    1,602
    I have used adodb in vb6 and now I have switched to C#. Can someone point me to a place with tutorials sow I can learn the easiest way to add database support to my windows/or command line C# application? I am using SQL.

    Most of my apps work like this:

    Client service application (update db and write logs)

    Database

    Webpage that shows heavy calculated info

    Which is the best way to code this? Can I integrate it all by using C#? Before I had to fibble with vb and com objects for the calculation part and an asp page mainly for showing text and tables.... and a few forms and textfields. Can this be easier in .NET since it all (db, web and client)is integrated? (Btw, I have medium skills in C++)


    best regards
    Henrik Nordgren
    Computer Operator
    ITT FLYGT
    Sweden

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width