Go Back   EQEmulator Home > EQEmulator Forums > Archives > Archive::Development > Archive::Tools

Archive::Tools Archive area for Tools's posts that were moved here after an inactivity period of 90 days.

Reply
 
Thread Tools Display Modes
  #1  
Old 11-05-2002, 10:36 AM
mByte
Hill Giant
 
Join Date: Feb 2002
Posts: 206
Default 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
Reply With Quote
  #2  
Old 11-05-2002, 12:01 PM
mByte
Hill Giant
 
Join Date: Feb 2002
Posts: 206
Default

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
__________________
mByte
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 12:06 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3