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");
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; using System.Threading.Tasks; using System.Data.SqlClient; namespace Yuri { public static class sqlCon { public static string server = ""; public static string db = ""; public static string id = ""; public static string pw = ""; public static SqlConnection con = new SqlConnection(@"Server="+sqlCon.server+";Database="+sqlCon.db+";User Id="+sqlCon.id+";Password="+sqlCon.pw+";MultipleActiveResultSets=True;Trusted_Connection=true"); public static void ChangeDB(string DBName) { try { switch (DBName) { case "Acc": con.ChangeDatabase("SRO_VT_ACCOUNT"); break; case "Shard": con.ChangeDatabase("SRO_VT_SHARD"); break; case "Log": con.ChangeDatabase("LOG_DB"); break; case "Event": con.ChangeDatabase("Yuri"); break; } } catch (Exception ex) { Console.WriteLine("ChangeDB function has some errors." + ex.ToString()); } } public static void exec(string query) { try { SqlCommand com = new SqlCommand(query, con); com.ExecuteNonQuery(); } catch (SqlException Ex) { Agent.TypeLog("MSSQL Error -> Function exec(" + query + "), exception catched : " + Ex.ToString()); } } //read string public static string ReadString(string query) { string strResult = null; try {
SqlCommand com = new SqlCommand(query, con); com.CommandType = CommandType.Text; strResult = (string)com.ExecuteScalar(); } catch (SqlException Ex) { Agent.TypeLog("MSSQL Error -> Function ReadString(" + query + "), exception catched : " + Ex.ToString()); } return strResult; } public static int ReadInt(string query) { int nResult = 0; try { SqlCommand com = new SqlCommand(query, con); com.CommandType = CommandType.Text; nResult = (int)com.ExecuteScalar(); } catch (SqlException Ex) { Agent.TypeLog("MSSQL Error -> Function ReadInt(" + query + "), exception catched : " + Ex.ToString()); } return nResult; } public static string[] getSingleArray(string query) { try {
SqlDataAdapter SqlAD = new SqlDataAdapter(); SqlAD.SelectCommand = new SqlCommand(query, con); DataSet ds = new DataSet(); SqlAD.Fill(ds);
DataTable dt = ds.Tables[0];
if(dt.Rows.Count != 0) { string[] arr = new string[dt.Rows[0].ItemArray.Length];
arr = InitializeArrays.InitStringArray(arr);
DataRow row = dt.Rows[0]; //first array
for (int i = 0; i < dt.Rows[0].ItemArray.Length; i++) { arr[i] = row[i].ToString();
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");
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
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