473,804 Members | 3,822 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.LocalM achine.OpenSubK ey("SOFTWARE\\O rigin Worlds
Online\\Ultima Online\\1.0");
String folder =
uo.GetValue("Ex ePath").ToStrin g();

String uopath = Path.GetDirecto ryName(folder);
StreamWriter writer = new StreamWriter(uo path +
@"\login.cfg ");
try
{
OdbcConnection mysqlcon;
OdbcCommand mysqlcom = new OdbcCommand();
mysqlcon = new OdbcConnection( "DRIVER={My SQL
ODBC 3.51 Driver};" + "SERVER=localho st;" +
"DATABASE=conne ctor;" + "UID=root;" +
"PWD=root;" );
StringBuilder uobuild = new StringBuilder() ;
uobuild.Append( "select ip,port from baglanti
where id=1");
mysqlcom.Comman dText = uobuild.ToStrin g();
OdbcDataReader resultuo =
mysqlcom.Execut eReader(Command Behavior.CloseC onnection);
String ip =
resultuo.GetVal ue(0).ToString( );

writer.WriteLin e("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 1579
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.co m

"Dakkar" <da****@sylveri a.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.LocalM achine.OpenSubK ey("SOFTWARE\\O rigin Worlds
Online\\Ultima Online\\1.0");
String folder =
uo.GetValue("Ex ePath").ToStrin g();

String uopath = Path.GetDirecto ryName(folder);
StreamWriter writer = new StreamWriter(uo path +
@"\login.cfg ");
try
{
OdbcConnection mysqlcon;
OdbcCommand mysqlcom = new OdbcCommand();
mysqlcon = new OdbcConnection( "DRIVER={My SQL
ODBC 3.51 Driver};" + "SERVER=localho st;" +
"DATABASE=conne ctor;" + "UID=root;" +
"PWD=root;" );
StringBuilder uobuild = new StringBuilder() ;
uobuild.Append( "select ip,port from baglanti
where id=1");
mysqlcom.Comman dText = uobuild.ToStrin g();
OdbcDataReader resultuo =
mysqlcom.Execut eReader(Command Behavior.CloseC onnection);
String ip =
resultuo.GetVal ue(0).ToString( );

writer.WriteLin e("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
3534
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 form for a number of platforms from our download pages at http://www.mysql.com/downloads/ and mirror sites.
4
11514
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 for me. 1) I put the file in /home/mlh/public_html/credifree/sql_script/. 2) I made that directory my current directory 3) I typed mysql and pressed ENTER 4) I then typed source mysql_dump.sql.txt and pressed ENTER A bunch of error...
11
17578
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 to load making any kind linkage with my Access data virtually useless. I have the MySQL driver setup in as a USER DSN. The MySQL data is sitting out on a server and the Access database is running locally. The network connection is very...
39
8434
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 of stammering and sputtering, and managed to pull out something I heard a couple of years back - that there was no real transaction safety in MySql. In flight transactions could be lost.
10
7410
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 recommend storing the image to the filesystem and only keeping a pointer to that in the table. I want to dump the image to a table. My code dumps the data into the table, however, I get the following error when trying to view the image "the image ......
1
3384
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 uses his own php shopping cart to receive customer orders. The configuration was done via cPanel with no external modifications - which produced no protests when built, ran and connected with no
15
4649
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 communicate with a MySQL database table on a web server, from inside of my company's Access-VBA application. I know VBA pretty well but have never before needed to do this HTTP/XML/MySQL type functions.
110
10641
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 case scenario for MyISAM backend? Also is it possible to not to lose data but get them corrupted?
30
2853
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', '$img', '$descr', '$user', '$size', '$format', '$cat', '$host', '$link', '$date')" or die(mysql_error()); And when the query gets executed i get back the following error:
39
5879
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 ISO-8859-1 -t UTF-8 mydb.sql mydb_utf8.sql mysqlCREATE DATABASE mydb_utf8 CHARACTER SET utf8 COLLATE utf8_general_ci;
0
9706
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9579
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10577
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10332
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10320
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6853
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5521
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3820
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.