-
Fototrend
Új hozzászólás Aktív témák
-
amargo
addikt
válasz
lakisoft #3002 üzenetére
static public class DecodeDatabase
{
private static SqlConnection m_DecodeConn;
public static SqlConnection DecodeConn
{
get { return DecodeDatabase.m_DecodeConn; }
}
public static void InitializeDecodeConnection()
{
m_DecodeConn = new SqlConnection();
try
{
m_DecodeConn.ConnectionString = @"Data Source=(local);Initial Catalog=MyDatabase;Integrated Security=True";
m_DecodeConn.Open();
}
catch (Exception e)
{
string s = e.Message + Environment.NewLine + m_DecodeConn.ConnectionString;
m_DecodeConn = null;
System.Windows.Forms.MessageBox.Show(s, System.Windows.Forms.Application.ProductName, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
throw e;
}
}
}
static public class Decode
{
static Decode()
{
//Inicializálja a dekód adatbázis kapcsolatot
DecodeDatabase.InitializeDecodeConnection();
}
static public string CTGetDecode(string sKey, string sTable, Languages cLanguage)
{
using (SqlCommand command = new SqlCommand())
{
command.Connection = DecodeDatabase.DecodeConn;
command.CommandType = CommandType.StoredProcedure;
command.CommandText = "dbo.GetDecode";
//command.Parameters.Add(new SqlParameter("@RETURN_VALUE",SqlDbType.Char,60));
command.Parameters.Add(new SqlParameter("@TableName", sTable));
command.Parameters.Add(new SqlParameter("@id", sKey));
object obj = command.ExecuteScalar();
if (null != obj)
{
return obj.ToString();
}
else
{
throw new ErrKeyNotFound(sKey);
}
}
}
}Így hirtelen, csak bekopiztam.. meg kicsit átírkáltam a neveket.. remélem nem felejtettem ki semmit..
Ez a lényeg.. alatta csak egy példa lekérdezés
m_DecodeConn.ConnectionString = @"Data Source=(local);Initial Catalog=MyDatabase;Integrated Security=True";
m_DecodeConn.Open();
Új hozzászólás Aktív témák
● olvasd el a téma összefoglalót!
- CSX 2x2GB (4GB) DDR 800 MHz kit
- ÁRGARANCIA!Épített KomPhone Ryzen 7 9800X3D 64GB RAM RTX 5080 16GB GAMER PC termékbeszámítással
- Samsung Galaxy S24 Ultra Titanium Black Titán dizájn, 200 MP Pro kamera, S Pen
- ÁRGARANCIA!Épített KomPhone Ryzen 9 5900X 16/32/64GB RAM RTX 5070 12GB GAMER PC termékbeszámítással
- GYÖNYÖRŰ iPhone 13 mini 128GB Red -1 ÉV GARANCIA - Kártyafüggetlen, MS3325
Állásajánlatok
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest
Cég: CAMERA-PRO Hungary Kft.
Város: Budapest