[C#] SQL Connect

12/26/2015 08:46 B13.#1
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"); 
12/26/2015 10:37 ​Goofie​#2
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
12/26/2015 13:39 B13.#3
didn't work
changed to .ini still nothing
12/27/2015 03:44 AceSpace#4
Please use google, stop using ready-to-use shits from eirene auto bot cause it's shit.
12/27/2015 06:12 B13.#5
Quote:
Originally Posted by Skipper* View Post
Please use google, stop using ready-to-use shits from eirene auto bot cause it's shit.
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
12/28/2015 01:02 sarkoplata#6
Your problem is not about connecting to sql, you can't read an .ini file...
12/28/2015 01:23 B13.#7
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 :D
12/28/2015 01:28 sarkoplata#8
i won't waste time explaining, just give tv info over skype, i'll do it