Register for your free account! | Forgot your password?

You last visited: Today at 17:18

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[C#] SQL Connect

Discussion on [C#] SQL Connect within the SRO Private Server forum part of the Silkroad Online category.

Reply
 
Old   #1
 
B13.'s Avatar
 
elite*gold: 0
Join Date: Jun 2012
Posts: 239
Received Thanks: 26
Question [C#] SQL Connect

hey guys im editing a released source and iam trying to make SQL connection
read from config.cfg file but when i do it like this
PHP Code:
         public static SqlConnection con = new SqlConnection(@"Server="+sqlCon.server+";Database="+sqlCon.db+";User Id="+sqlCon.id+";Password="+sqlCon.pw+";MultipleActiveResultSets=True;Trusted_Connection=true"); 
and config.cfg like this
it wont work
Full sqlCon.cs
config.cs
any hint how to make it read server name from the .cfg ?
****************
but like this it works
PHP Code:
        public static SqlConnection con = new SqlConnection(@"Server=WIN-123WIN\SQLEXPRESS"+sqlCon.db+sqlCon.id+sqlCon.pw+"; MultipleActiveResultSets=True;Trusted_Connection=true"); 
B13. is offline  
Old 12/26/2015, 10:37   #2
 
elite*gold: 0
Join Date: Apr 2015
Posts: 1,444
Received Thanks: 1,371
Test this:

Code:
public static iniFile cfg = new iniFile("config.cfg");
public static SqlConnection con = new SqlConnection(@"Server=" + cfg.IniReadValue("SQL", "ServerName") + ";Database=" + cfg.IniReadValue("SQL", "db") + ";User Id=" + cfg.IniReadValue("SQL", "id") + ";Password=" + cfg.IniReadValue("SQL", "pw") + ";MultipleActiveResultSets=True");
If that don't work, change name on your config.cfg to config.ini
​Goofie​ is offline  
Thanks
1 User
Old 12/26/2015, 13:39   #3
 
B13.'s Avatar
 
elite*gold: 0
Join Date: Jun 2012
Posts: 239
Received Thanks: 26
didn't work
changed to .ini still nothing
B13. is offline  
Old 12/27/2015, 03:44   #4

 
AceSpace's Avatar
 
elite*gold: 71
Join Date: Mar 2011
Posts: 1,594
Received Thanks: 1,099
Please use google, stop using ready-to-use ***** from eirene auto bot cause it's ****.
AceSpace is offline  
Thanks
1 User
Old 12/27/2015, 06:12   #5
 
B13.'s Avatar
 
elite*gold: 0
Join Date: Jun 2012
Posts: 239
Received Thanks: 26
Quote:
Originally Posted by Skipper* View Post
Please use google, stop using ready-to-use ***** from eirene auto bot cause it's ****.
ok i will , maybe i needed a place to start or some thing to try on what is going on my until i learn how to do it on my own
i still need to know how to do it
B13. is offline  
Old 12/28/2015, 01:02   #6

 
sarkoplata's Avatar
 
elite*gold: 166
Join Date: Apr 2009
Posts: 2,339
Received Thanks: 2,654
Your problem is not about connecting to sql, you can't read an .ini file...
sarkoplata is offline  
Thanks
1 User
Old 12/28/2015, 01:23   #7
 
B13.'s Avatar
 
elite*gold: 0
Join Date: Jun 2012
Posts: 239
Received Thanks: 26
Quote:
Originally Posted by sarkoplata View Post
Your problem is not about connecting to sql, you can't read an .ini file...
"you" means me or the prog ? feeling a bit trolled
B13. is offline  
Old 12/28/2015, 01:28   #8

 
sarkoplata's Avatar
 
elite*gold: 166
Join Date: Apr 2009
Posts: 2,339
Received Thanks: 2,654
i won't waste time explaining, just give tv info over skype, i'll do it
sarkoplata is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
Minecraft Hamachi Server Failed to connect to the server Connection refused connect
01/26/2012 - Minecraft - 1 Replies
Hallo zusammen, Wir haben einen Hamachi Server, den wir für den Multiplayer Mode von Minecraft verwenden. Bis jetzt ging alles einwandfrei, doch seit heute geht nix mehr. Der Ersteller vom Hamachi Server ist zwar online, doch wenn ich in den Server in Minecraft reingehe, kommt die Fehlermeldung: Failed to connect to the server Connection refused: connect Was geht da schief? Danke im Voraus. MfG kugelmanno
Connect DB connect connection refused HILFE!
02/27/2011 - Metin2 Private Server - 4 Replies
Ich habe mir einen server mit 2 Channels erstellt und beim starten kommt immer dieser fehler -.- in navicat hab ich versucht alle tabellen zu reparieren, aber bei information_shema kommt acces diened Bild: http://img825.imageshack.us/i/picturers.jpg/ Server startet und kann mich auch einloggen
proplem (connect: connect refused)
02/20/2010 - Metin2 Private Server - 5 Replies
hi ich habe ein porplem wenn ich mein server starte steht als erstes 8 felher meldungen udn dan ungefähr 11 mal connect: connect refused dan dauert es aufeinmal voll lange bis ich mich einlogge



All times are GMT +2. The time now is 17:18.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.