本文整理汇总了C#中DataBaseConnection类的典型用法代码示例。如果您正苦于以下问题:C# DataBaseConnection类的具体用法?C# DataBaseConnection怎么用?C# DataBaseConnection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataBaseConnection类属于命名空间,在下文中一共展示了DataBaseConnection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetListSchools
public List<Schoolsc> GetListSchools()
{
List<Schoolsc> list = new List<Schoolsc>();
Schoolsc ins;
//...Database Connection...
DataBaseConnection dbConn = new DataBaseConnection();
SqlConnection con = dbConn.SqlConn();
SqlCommand cmdI;
//...SQL Commands...
cmdI = new SqlCommand("SELECT * FROM Schools ", con);
cmdI.Connection.Open();
SqlDataReader drI = cmdI.ExecuteReader();
//...Retrieve Data...
if (drI.HasRows)
{
while (drI.Read())
{
ins = new Schoolsc();
ins.SchoolId = Convert.ToInt32(drI["SchoolId"]);
ins.ClientId = Convert.ToInt32(drI["ClientId"]);
ins.SchoolName = drI["SchoolName"].ToString();
ins.Schoolabbreviation = drI["Schoolabbreviation"].ToString();
ins.PictureId = Convert.ToInt32(drI["PictureId"]);
list.Add(ins);
}
}
drI.Close();
con.Close();
return list;
}
开发者ID:Ricium,项目名称:NIWZ_101,代码行数:34,代码来源:SchoolsRepository.cs
示例2: GetSchoolList
public List<SelectListItem> GetSchoolList()
{
List<SelectListItem> list = new List<SelectListItem>();
SelectListItem ins;
//...Database Connection...
DataBaseConnection dbConn = new DataBaseConnection();
SqlConnection con = dbConn.SqlConn();
SqlCommand cmdI;
//...SQL Commands...
cmdI = new SqlCommand("SELECT * FROM Client", con);
cmdI.Connection.Open();
SqlDataReader drI = cmdI.ExecuteReader();
//...Retrieve Data...
if (drI.HasRows)
{
while (drI.Read())
{
ins = new SelectListItem();
ins.Value = drI["ClientId"].ToString();
ins.Text = drI["Name"].ToString();
list.Add(ins);
}
}
drI.Close();
con.Close();
return list;
}
开发者ID:Ricium,项目名称:NIWZ_101,代码行数:31,代码来源:SchoolInfoRepository.cs
示例3: GetLastPictureId
public int GetLastPictureId(int ClientId)
{
int returnValue = 0;
//...Database Connection...
DataBaseConnection dbConn = new DataBaseConnection();
SqlConnection con = dbConn.SqlConn();
SqlCommand cmdI;
//...SQL Commands...
cmdI = new SqlCommand("SELECT TOP 1 PictureId FROM Picture WHERE ClientId=" + ClientId + " ORDER BY PictureId DESC", con);
cmdI.Connection.Open();
SqlDataReader drI = cmdI.ExecuteReader();
//...Retrieve Data...
if (drI.HasRows)
{
while (drI.Read())
{
returnValue = Convert.ToInt32(drI["PictureId"]);
}
}
drI.Close();
con.Close();
return returnValue;
}
开发者ID:Ricium,项目名称:NIWZ_101,代码行数:27,代码来源:PictureRepository.cs
示例4: GetNews
public int GetNews(int ClientId)
{
int returnValue = 0;
//...Database Connection...
DataBaseConnection dbConn = new DataBaseConnection();
SqlConnection con = dbConn.SqlConn();
SqlCommand cmdI;
//...SQL Commands...
cmdI = new SqlCommand("SELECT COUNT(ClientId) as NumberOfUsers FROM News WHERE ClientId =" + ClientId, con);
cmdI.Connection.Open();
SqlDataReader drI = cmdI.ExecuteReader();
//...Retrieve Data...
if (drI.HasRows)
{
while (drI.Read())
{
returnValue = Convert.ToInt32(drI["NumberOfUsers"]);
}
}
//...Clean Up...
drI.Close();
con.Close();
//...Return...
return returnValue;
}
开发者ID:Ricium,项目名称:NIWZ_101,代码行数:30,代码来源:StatsRepository.cs
示例5: GetClient
public Client GetClient(int ClientId)
{
Client ins = new Client();
//...Database Connection...
DataBaseConnection dbConn = new DataBaseConnection();
SqlConnection con = dbConn.SqlConn();
SqlCommand cmdI;
//...SQL Commands...
cmdI = new SqlCommand("SELECT * FROM Client WHERE ClientId =" + ClientId, con);
cmdI.Connection.Open();
SqlDataReader drI = cmdI.ExecuteReader();
//...Retrieve Data...
if (drI.HasRows)
{
while (drI.Read())
{
ins.ClientId = Convert.ToInt32(drI["ClientId"]);
ins.Name = drI["Name"].ToString();
}
}
drI.Close();
con.Close();
return ins;
}
开发者ID:Ricium,项目名称:NIWZ_101,代码行数:28,代码来源:SchoolInfoRepository.cs
示例6: GetAutoCompleteInvoiceNumbers
public List<string> GetAutoCompleteInvoiceNumbers(DateTime date, int SupplierId)
{
List<string> obj = new List<string>();
DataBaseConnection dbConn = new DataBaseConnection();
SqlConnection con = dbConn.SqlConn();
SqlCommand cmdI = new SqlCommand("Select g.InvoiceNumber, g.GRVTypeID from t_GRVList g left join t_SparRecon sr on g.InvoiceNumber=sr.InvoiceNumber and g.GRVTypeID = sr.GRVTypeId "
+ " where g.InvoiceDate BETWEEN DATEADD(DAY, -7,'" + date.ToShortDateString() + "') AND '" + date.ToShortDateString() + "' and g.SupplierID = " + SupplierId
+ " and COALESCE(sr.SparReconId,0) = 0 and g.Removed =0 ", con);
cmdI.Connection.Open();
SqlDataReader drI = cmdI.ExecuteReader();
if (drI.HasRows)
{
while (drI.Read())
{
if (Convert.ToInt16(drI["GRVTypeID"]) == 1)
{
obj.Add(drI["InvoiceNumber"].ToString() + " - GRV");
}
else
{
obj.Add(drI["InvoiceNumber"].ToString() + " - CLM");
}
}
}
drI.Close();
con.Close();
con.Dispose();
return obj;
}
开发者ID:Ricium,项目名称:Sparstelsel_Qbit_Opentobecolsed,代码行数:33,代码来源:SparReconRepository.cs
示例7: GetSportCategory
public SportCategory GetSportCategory(int SportCategoryId)
{
SportCategory ins = new SportCategory();
//...Database Connection...
DataBaseConnection dbConn = new DataBaseConnection();
SqlConnection con = dbConn.SqlConn();
SqlCommand cmdI;
//...SQL Commands...
cmdI = new SqlCommand("SELECT * FROM SportCategory WHERE SportCategoryId =" + SportCategoryId, con);
cmdI.Connection.Open();
SqlDataReader drI = cmdI.ExecuteReader();
//...Retrieve Data...
if (drI.HasRows)
{
while (drI.Read())
{
ins.SportCategoryID = Convert.ToInt32(drI["SportCategoryId"]);
ins.ClientID = Convert.ToInt32(drI["ClientId"]);
ins.CategoryName = drI["CategoryName"].ToString();
}
}
drI.Close();
con.Close();
return ins;
}
开发者ID:Ricium,项目名称:NIWZ_101,代码行数:30,代码来源:SportCategoryRepository.cs
示例8: GetListCategoryDropDown
public List<SelectListItem> GetListCategoryDropDown()
{
List<SelectListItem> list = new List<SelectListItem>();
//...Database Connection...
DataBaseConnection dbConn = new DataBaseConnection();
SqlConnection con = dbConn.SqlConn();
SqlCommand cmdI;
//...SQL Commands...
cmdI = new SqlCommand("SELECT * FROM Category", con);
cmdI.Connection.Open();
SqlDataReader drI = cmdI.ExecuteReader();
//...Retrieve Data...
if (drI.HasRows)
{
while (drI.Read())
{
var toAdd = new SelectListItem();
toAdd.Text = drI["Title"].ToString();
toAdd.Value = drI["CategoryId"].ToString();
list.Add(toAdd);
}
}
drI.Close();
con.Close();
return list;
}
开发者ID:Ricium,项目名称:NIWZ_101,代码行数:30,代码来源:CategoryRepository.cs
示例9: GetFields
public List<SelectListItem> GetFields()
{
List<SelectListItem> obj = new List<SelectListItem>();
DataBaseConnection dbConn = new DataBaseConnection();
SqlConnection con = dbConn.SqlConn();
SqlCommand cmdI = new SqlCommand("SELECT * FROM Fields ", con);
cmdI.Connection.Open();
SqlDataReader drI = cmdI.ExecuteReader();
if (drI.HasRows)
{
while (drI.Read())
{
var result = new SelectListItem();
result.Text = drI["FieldName"].ToString();
result.Value = drI["FieldsId"].ToString();
obj.Add(result);
}
}
drI.Close();
con.Close();
con.Dispose();
return obj;
}
开发者ID:Ricium,项目名称:NIWZ_101,代码行数:26,代码来源:FixturesRepository.cs
示例10: GetAllUsernames
public List<string> GetAllUsernames()
{
List<string> usernames = new List<string>();
DataBaseConnection dbConn = new DataBaseConnection();
SqlConnection con = dbConn.SqlConn();
SqlCommand cmdI = con.CreateCommand();
cmdI.Connection = con;
cmdI.Parameters.Clear();
cmdI.CommandText = CommonStrings.GetAllUsers;
cmdI.CommandType = System.Data.CommandType.StoredProcedure;
cmdI.Connection.Open();
SqlDataReader drI = cmdI.ExecuteReader();
if (drI.HasRows)
{
while (drI.Read())
{
usernames.Add(drI["Username"].ToString());
}
}
cmdI.Connection.Close();
con.Dispose();
return usernames;
}
开发者ID:Ricium,项目名称:Wetu,代码行数:29,代码来源:CommonRepository.cs
示例11: GetFixtures
public List<SelectListItem> GetFixtures(int? sc)
{
List<SelectListItem> obj = new List<SelectListItem>();
DataBaseConnection dbConn = new DataBaseConnection();
SqlConnection con = dbConn.SqlConn();
SqlCommand cmdI = new SqlCommand("select f.*,s.Schoolabbreviation as teamA,sb.Schoolabbreviation as teamB,t.Age as AgeA,tb.Age as AgeB,t.Ranks as RankA,tb.Ranks as RankB from fixtures f inner join Teams t on f.TeamIdA = t.TeamsId inner join Teams tb on f.TeamIdB=tb.TeamsId inner join Schools s on t.SchoolId = s.SchoolId inner join Schools sb on tb.SchoolId = sb.SchoolId where f.SportCategoryID ='"+sc+"'and f.FixturesId not in (select FixtureId from Results) ", con);
cmdI.Connection.Open();
SqlDataReader drI = cmdI.ExecuteReader();
if (drI.HasRows)
{
while (drI.Read())
{
var result = new SelectListItem();
result.Text = drI["teamA"].ToString() + " " + drI["AgeA"].ToString() + "/" + drI["RankA"].ToString() + " VS " + drI["teamB"].ToString() + " " + drI["AgeB"].ToString() + "/" + drI["RankB"].ToString() + " " + drI["StartTime"].ToString();
result.Value = drI["FixturesId"].ToString();
obj.Add(result);
}
}
drI.Close();
con.Close();
con.Dispose();
return obj;
}
开发者ID:Ricium,项目名称:NIWZ_101,代码行数:26,代码来源:ResultsRepository.cs
示例12: GetPublicRegistrar
public List<int> GetPublicRegistrar()
{
List<int> ReturnObject = new List<int>();
DataBaseConnection dbConn = new DataBaseConnection();
using (var con = dbConn.SqlConn())
{
con.Open();
using (SqlCommand cmd = new SqlCommand("exec " + CommonStrings.GetPublicRegistrar, con))
{
using (var drI = cmd.ExecuteReader())
{
while (drI.Read())
{
ReturnObject.Add(Convert.ToInt32(drI["AnimalId"]));
}
}
}
}
return ReturnObject;
}
开发者ID:Ricium,项目名称:Wetu,代码行数:26,代码来源:SimulateRepository.cs
示例13: GetAnimals
public List<AnimalSim> GetAnimals(int CompanyId, int SexId)
{
List<AnimalSim> ReturnObject = new List<AnimalSim>();
AnimalSim ins;
DataBaseConnection dbConn = new DataBaseConnection();
using (var con = dbConn.SqlConn())
{
con.Open();
using (SqlCommand cmd = new SqlCommand("exec " + CommonStrings.SimAnimals + " @CompanyId, @SexId", con))
{
cmd.Parameters.AddWithValue("@CompanyId", CompanyId);
cmd.Parameters.AddWithValue("@SexId", SexId);
using (var drI = cmd.ExecuteReader())
{
while (drI.Read())
{
ins = new AnimalSim();
ins.AnimalId = Convert.ToInt32(drI["AnimalId"]);
ins.DeviceAddress = drI["DeviceAddress"].ToString();
ReturnObject.Add(ins);
}
}
}
}
return ReturnObject;
}
开发者ID:Ricium,项目名称:Wetu,代码行数:32,代码来源:SimulateRepository.cs
示例14: GetClientId
public void GetClientId(string UserName)
{
string ClientId = "";
MembershipUser user = Membership.GetUser(UserName);
Guid guid = (Guid)user.ProviderUserKey;
DataBaseConnection dbConn = new DataBaseConnection();
SqlConnection con = dbConn.AuthConn();
SqlCommand cmdI = new SqlCommand("SELECT ClientId FROM Users WHERE UserId='" + guid + "'", con);
cmdI.Connection.Open();
SqlDataReader drI = cmdI.ExecuteReader();
if (drI.HasRows)
{
while (drI.Read())
{
ClientId = drI["ClientId"].ToString();
}
}
drI.Close();
con.Close();
drI.Dispose();
con.Dispose();
HttpContext.Current.Session["ClientId"] = ClientId;
}
开发者ID:Ricium,项目名称:NIWZ_101,代码行数:26,代码来源:UserRepository.cs
示例15: GetAutoCompleteInvoiceNumbers
public List<string> GetAutoCompleteInvoiceNumbers(int SupplierId)
{
List<string> obj = new List<string>();
DataBaseConnection dbConn = new DataBaseConnection();
SqlConnection con = dbConn.SqlConn();
SqlCommand cmdI = new SqlCommand("Select DISTINCT (g.InvoiceNumber + ' ' + s.Supplier) as InvoiceNumber "
+ " from t_GRVList g "
+ " left join t_ProofOfPayment p "
+ " on UPPER(g.InvoiceNumber) = UPPER(p.InvoiceNumber) "
+ " inner join t_Supplier s on g.SupplierID = s.SupplierID "
+ " where g.Removed=0 and g.SupplierID = " + SupplierId
+ " and COALESCE(p.ProofOfPaymentID,0) = 0 "
+ " order by InvoiceNumber ", con);
cmdI.Connection.Open();
SqlDataReader drI = cmdI.ExecuteReader();
if (drI.HasRows)
{
while (drI.Read())
{
obj.Add(drI["InvoiceNumber"].ToString());
}
}
drI.Close();
con.Close();
con.Dispose();
return obj;
}
开发者ID:Ricium,项目名称:Sparstelsel_Qbit_Opentobecolsed,代码行数:30,代码来源:DropDownRepository.cs
示例16: GetFixtures
public Fixtures GetFixtures(int FixturesId)
{
Fixtures ins = new Fixtures();
//...Database Connection...
DataBaseConnection dbConn = new DataBaseConnection();
SqlConnection con = dbConn.SqlConn();
SqlCommand cmdI;
//...SQL Commands...
cmdI = new SqlCommand("SELECT * FROM fixtures WHERE FixturesId =" + FixturesId, con);
cmdI.Connection.Open();
SqlDataReader drI = cmdI.ExecuteReader();
//...Retrieve Data...
if (drI.HasRows)
{
while (drI.Read())
{
ins.FixturesId = Convert.ToInt32(drI["FixturesId"]);
ins.ClientId = Convert.ToInt32(drI["ClientId"]);
ins.TeamIdA = Convert.ToInt32(drI["TeamIdA"]);
ins.TeamIdB = Convert.ToInt32(drI["TeamIdB"]);
ins.StartTime = Convert.ToDateTime(drI["StartTime"]);
ins.FieldId = Convert.ToInt32(drI["FieldsId"]);
ins.SportCategoryId = Convert.ToInt32(drI["SportCategoryId"]);
}
}
drI.Close();
con.Close();
return ins;
}
开发者ID:Ricium,项目名称:NIWZ_101,代码行数:34,代码来源:FixturesRepository.cs
示例17: GetFacebookToken
public string GetFacebookToken(int ClientId)
{
string returnValue = "";
//...Database Connection...
DataBaseConnection dbConn = new DataBaseConnection();
SqlConnection con = dbConn.SqlConn();
SqlCommand cmdI;
//...SQL Commands...
cmdI = new SqlCommand("SELECT * FROM Settings WHERE ClientId = " + ClientId + " AND Setting = 'facebook'", con);
cmdI.Connection.Open();
SqlDataReader drI = cmdI.ExecuteReader();
//...Retrieve Data...
if (drI.HasRows)
{
while (drI.Read())
{
returnValue = drI["Value"].ToString();
}
}
drI.Close();
con.Close();
return returnValue;
}
开发者ID:Ricium,项目名称:NIWZ_101,代码行数:28,代码来源:SettingRepository.cs
示例18: CheckGRVDuplicate
public bool CheckGRVDuplicate(string Number)
{
//...Database Connection...
DataBaseConnection dbConn = new DataBaseConnection();
SqlConnection con = dbConn.SqlConn();
SqlCommand cmdI;
//...SQL Commands...
cmdI = new SqlCommand("SELECT GRVListID FROM t_GRVList WHERE Number ='" + Number + "' AND Removed = 0", con);
cmdI.Connection.Open();
SqlDataReader drI = cmdI.ExecuteReader();
bool ret = false;
//...Retrieve Data...
if (drI.HasRows)
{
ret = true;
}
//...Close Connections...
drI.Close();
con.Close();
//...Return...
return ret;
}
开发者ID:Ricium,项目名称:Sparstelsel_Qbit_Opentobecolsed,代码行数:27,代码来源:GRVListRepository.cs
示例19: GetListSportCategoryportCategorys
public List<SportCategory> GetListSportCategoryportCategorys()
{
List<SportCategory> list = new List<SportCategory>();
SportCategory ins;
//...Database Connection...
DataBaseConnection dbConn = new DataBaseConnection();
SqlConnection con = dbConn.SqlConn();
SqlCommand cmdI;
//...SQL Commands...
cmdI = new SqlCommand("SELECT * from SportCategory", con);
cmdI.Connection.Open();
SqlDataReader drI = cmdI.ExecuteReader();
//...Retrieve Data...
if (drI.HasRows)
{
while (drI.Read())
{
ins = new SportCategory();
ins.SportCategoryID = Convert.ToInt32(drI["SportCategoryId"]);
ins.ClientID = Convert.ToInt32(drI["ClientId"]);
ins.CategoryName = drI["CategoryName"].ToString();
list.Add(ins);
}
}
drI.Close();
con.Close();
return list;
}
开发者ID:Ricium,项目名称:NIWZ_101,代码行数:32,代码来源:SportCategoryRepository.cs
示例20: frmMain
public frmMain()
{
InitializeComponent();
DBC = new DataBaseConnection();
FVSSI = new MSVSS32.MSVSS();
colEmpresas = new Empresass();
//----------
txtInformacionCompartidos.ForeColor = Color.Red;
//----------
lstEmpresas.MouseDoubleClick+=new MouseEventHandler(lstEmpresas_MouseDoubleClick);
lstEmpresas.MouseClick += new MouseEventHandler(lstEmpresas_MouseClick);
//----------
txtBusquedaEmpresa.KeyDown += new KeyEventHandler(txtBusquedaEmpresa_KeyDown);
txtBusquedaEmpresa.KeyPress += new KeyPressEventHandler(txtBusquedaEmpresa_KeyPress);
txtBusquedaEmpresa.TextChanged += new EventHandler(txtBusquedaEmpresa_TextChanged);
txtBusquedaEmpresa.Enter += new EventHandler(txtBusquedaEmpresa_Enter);
//----------
tvw.ContextMenuStrip = conMenu1;
tvw.KeyUp += new KeyEventHandler(tvw_KeyUp);
tvw.NodeMouseClick+=new TreeNodeMouseClickEventHandler(tvw_NodeMouseClick);
tvw.DoubleClick+=new EventHandler(tvw_DoubleClick);
tvw.DrawNode += new DrawTreeNodeEventHandler(tvw_DrawNode);
//tvw.DrawMode = TreeViewDrawMode.OwnerDrawText;
//tvw.DrawNode += new DrawTreeNodeEventHandler(tvw_DrawNode);
}
开发者ID:Manuells,项目名称:VssShared,代码行数:26,代码来源:frmMain.cs
注:本文中的DataBaseConnection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论