EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Archive::Tools (https://www.eqemulator.org/forums/forumdisplay.php?f=623)
-   -   mySql connection? (https://www.eqemulator.org/forums/showthread.php?t=3751)

mByte 11-05-2002 10:36 AM

mySql connection?
 
Does anybody know how to pull a record out of a database in C#?

I know how to access the database in php and in vp.net but I cannot get this code to work.

This code opens the database but I cannot pull information out with objDR.ExecuteReader().

anyhelp would be cool :)


MySqlConnection objConn;
MySqlCommand objCmd;
MySqlDataReader objDR;
string sqlQuery, objConnStr;
//int id;

objConnStr = "Data source=localhost;database=eq311;" +
"user id=sa;password=sa;command logging=false;";

objConn = new MySqlConnection(objConnStr);
objConn.Open();

sqlQuery = "Select * from items";

objCmd = new MySqlCommand();

objCmd.CommandType = CommandType.Text;
objCmd.CommandTimeout=30;
objCmd.CommandText=sqlQuery;
objCmd.Connection=objConn;

label1.Text = objConn.State.ToString();

mByte 11-05-2002 12:01 PM

Nevermind figured out it was the file i was importing to talk to sqldb that was the problem.

I had to use a odbc connection but it works now :)


All times are GMT -4. The time now is 02:48 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.