-
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
-
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
-
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
-
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!!!
-
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.
-
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