473,387 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

MySql Data Read Problem?

I write a program for connecting to mysql database and read the values
that i want from the database so i wrote my code like this
RegistryKey uo =
Registry.LocalMachine.OpenSubKey("SOFTWARE\\Origin Worlds
Online\\Ultima Online\\1.0");
String folder =
uo.GetValue("ExePath").ToString();

String uopath = Path.GetDirectoryName(folder);
StreamWriter writer = new StreamWriter(uopath +
@"\login.cfg");
try
{
OdbcConnection mysqlcon;
OdbcCommand mysqlcom = new OdbcCommand();
mysqlcon = new OdbcConnection("DRIVER={MySQL
ODBC 3.51 Driver};" + "SERVER=localhost;" +
"DATABASE=connector;" + "UID=root;" +
"PWD=root;");
StringBuilder uobuild = new StringBuilder();
uobuild.Append("select ip,port from baglanti
where id=1");
mysqlcom.CommandText = uobuild.ToString();
OdbcDataReader resultuo =
mysqlcom.ExecuteReader(CommandBehavior.CloseConnec tion);
String ip =
resultuo.GetValue(0).ToString();

writer.WriteLine("LoginServer="+ip+",5631");
writer.Close();
}

catch
{
this.txt1.Text += "Dosya Bulunamadi";
}
but its not working what is the problem?

Note:My program should take both ip and port part from mysql and write
it to file that i want

Thanks
*---------------------------------*
Posted at: http://www.GroupSrv.com
*---------------------------------*

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 16 '05 #1
4 1551
Dakkar,

You really should be playing Worlds of Warcraft instead, much better
MMORPG IMO. =)

How is it not working? Is ip a string or is it an integer? It could be
that it is an integer made up of the four values that make up the IP ranges.
If this is the case, you will have to pull it apart, using an overload of
the IPAddress class.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Dakkar" <da****@sylveria.gen-dot-tr.no-spam.invalid> wrote in message
news:41********@127.0.0.1...
I write a program for connecting to mysql database and read the values
that i want from the database so i wrote my code like this
RegistryKey uo =
Registry.LocalMachine.OpenSubKey("SOFTWARE\\Origin Worlds
Online\\Ultima Online\\1.0");
String folder =
uo.GetValue("ExePath").ToString();

String uopath = Path.GetDirectoryName(folder);
StreamWriter writer = new StreamWriter(uopath +
@"\login.cfg");
try
{
OdbcConnection mysqlcon;
OdbcCommand mysqlcom = new OdbcCommand();
mysqlcon = new OdbcConnection("DRIVER={MySQL
ODBC 3.51 Driver};" + "SERVER=localhost;" +
"DATABASE=connector;" + "UID=root;" +
"PWD=root;");
StringBuilder uobuild = new StringBuilder();
uobuild.Append("select ip,port from baglanti
where id=1");
mysqlcom.CommandText = uobuild.ToString();
OdbcDataReader resultuo =
mysqlcom.ExecuteReader(CommandBehavior.CloseConnec tion);
String ip =
resultuo.GetValue(0).ToString();

writer.WriteLine("LoginServer="+ip+",5631");
writer.Close();
}

catch
{
this.txt1.Text += "Dosya Bulunamadi";
}
but its not working what is the problem?

Note:My program should take both ip and port part from mysql and write
it to file that i want

Thanks
*---------------------------------*
Posted at: http://www.GroupSrv.com
*---------------------------------*

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com

Nov 16 '05 #2
No that ip means
a mysql table data i'm keeping the ip inside of the mysql table as a
varchar(string) like 127.0.0.1 so i just want to pull that data from
mysql to c#
*---------------------------------*
Posted at: http://www.GroupSrv.com
*---------------------------------*

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 16 '05 #3
any idea?
*---------------------------------*
Posted at: http://www.GroupSrv.com
*---------------------------------*

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 16 '05 #4
any idea?
*---------------------------------*
Posted at: http://www.GroupSrv.com
*---------------------------------*

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Lenz Grimmer | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, MySQL 4.0.14, a new version of the popular Open Source/Free Software Database, has been released. It is now available in source and binary...
4
by: MLH | last post by:
I am having failures processing the following command and I wonder if you can tell me what I must do in order to have success. When I try to run source mysql_dump.sql.txt ==> it is a problem...
11
by: DJJ | last post by:
I am using the MySQL ODBC 3.51 driver to link three relatively small MySQL tables to a Microsoft Access 2003 database. I am finding that the data from the MySQL tables takes a hell of a long time...
39
by: Mairhtin O'Feannag | last post by:
Hello, I have a client (customer) who asked the question : "Why would I buy and use UDB, when MySql is free?" I had to say I was stunned. I have no experience with MySql, so I was left sort...
10
by: John Smith | last post by:
I know that uploading an image to a database has been covered, oh, about 3 trillion times. However, I haven't found anything covering uploading to a MySQL database with .net. Please don't...
1
by: jlee | last post by:
I'm pretty much a newbie on mysql, and I need some help. I am running mysql Ver 12.22 Distrib 4.0.24, for portbld-freebsd5.4 (i386) on a server hosting an active website. The site's developer...
15
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to...
110
by: alf | last post by:
Hi, is it possible that due to OS crash or mysql itself crash or some e.g. SCSI failure to lose all the data stored in the table (let's say million of 1KB rows). In other words what is the worst...
30
by: Einstein30000 | last post by:
Hi, in one of my php-scripts is the following query (with an already open db-connection): $q = "INSERT INTO main (name, img, descr, from, size, format, cat, host, link, date) VALUES ('$name',...
39
by: alex | last post by:
I've converted a latin1 database I have to utf8. The process has been: # mysqldump -u root -p --default-character-set=latin1 -c --insert-ignore --skip-set-charset mydb mydb.sql # iconv -f...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.