Maverick_Cool
asked on
remote connection to mysql server in ubuntu using vc# installed in other system
am using mysql server installed in ubuntu and i made the the remote connection successful.Even though the connection was successful am not able to access mysql namespace in c#,as am novice to this mysql can some one help me in this regard how can i access that mysql namespace and provide me some sample to execute queries like connection string and filling dataset with adapter classes .....
can i able to make the connection string using adodb? how can i do this some one can help me please
thanks in advance
can i able to make the connection string using adodb? how can i do this some one can help me please
thanks in advance
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
oops. you said adodb. open the db with oledb then do this
using System.Data;
using System.Data.OleDb;
using ADODB;
string DBConnection = "xxxx"";
string SQL = "select title_id,title,type,price from ....";
//create ADODB Connection object
ADODB.Connection Conn=new ADODB.Connection();
//create ADODB Recordset object
ADODB.Recordset rs= new ADODB.Recordset();
//create OleDb Adapter object
OleDbDataAdapter daTitles=new OleDbDataAdapter();
// finally Dataset to store returned recordset
DataSet dsTitles=new DataSet("Authors");
//open connection with the string as above
Conn.Open(DBConnection,"","",-1);
//execute the query specifying static sursor, batch optimistic locking
rs.Open(SQL,DBConnection,ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockBatchOptimistic,1);
//use the overloaded version of Fill method which takes recordset as parameter
daTitles.Fill(dsTitles,rs,"Tiltes");
//bind datagrid to dataset
dataGridTitles.SetDataBinding(dsTitles,"Tiltes");
///close the connection
Conn.Close();
}
using MySql.Data.MySqlClient;