本文整理汇总了C#中Connector.CloseConnection方法的典型用法代码示例。如果您正苦于以下问题:C# Connector.CloseConnection方法的具体用法?C# Connector.CloseConnection怎么用?C# Connector.CloseConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Connector
的用法示例。
在下文中一共展示了Connector.CloseConnection方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: isVolunteer
private bool isVolunteer(string NFC = "")
{
js = new Connector(AccessRegistryTool.ReadValue("DBServer"),"Kids_Checkin", "kidschurch", "[email protected]");
string sql = "SELECT * FROM tblVolunteers WHERE fldNFCCode='" + NFC + "'";
js.ExecuteQuery(sql);
js.RiD.Read();
if(js.RiD.HasRows)
{
js.CloseConnection();
return true;
}
else
{
js.CloseConnection();
return false;
}
}
示例2: LoadNewComer
private void LoadNewComer()
{
try
{
string q = "SELECT * FROM tblAttendance WHERE fldLoginDateTime BETWEEN '" + DateTime.Now.ToShortDateString() + " 00:00:00' AND '" + DateTime.Now.ToShortDateString() + " 23:59:59' AND fldEventID='" + fldEventID + "' AND fldRoomID='" + fldRoomID + "' AND fldLogoutDateTime IS NULL ORDER BY fldID DESC";
js.ExecuteQuery(q);
//string bc = js.getBarcode();
dgvNew.Rows.Clear();
while (js.RiD.Read())
{
string DBServer = AccessRegistryTool.ReadValue("DBServer");
string DBase = "Kids_Checkin";
string DBUser = "kidschurch";
string DBPass = "[email protected]";
string connectionstring = "Server=" + DBServer + ";Database=" + DBase + ";User Id=" + DBUser + ";Password=" + DBPass + ";";
Connector kid = new Connector(DBServer, DBase, DBUser, DBPass);
string kidID = js.RiD["fldKidsID"].ToString();
string id = "";
string qry = "SELECT * FROM tblKids WHERE fldStudentID='" + kidID + "'";
kid.ExecuteQuery(qry);
kid.RiD.Read();
DataGridViewImageColumn img = new DataGridViewImageColumn();
string pic = kid.RiD["fldPicture"].ToString();
id = kid.RiD["fldID"].ToString();
string picture = js.GetPath() + "/Kids/" + pic;
if (System.IO.File.Exists(picture))
{
img.Image = Image.FromFile(picture);
img.Image = (Image)(new Bitmap(img.Image, new Size(150, 150)));
}
else
{
img.Image = Image.FromFile(Application.StartupPath + "/Pictures/download.jpg");
img.Image = (Image)(new Bitmap(img.Image, new Size(150, 150)));
}
string creationdate = js.Lookup("fldDateCreated", "tblKids", "fldStudentID='" + kidID + "'");
DateTime cdate = new DateTime();
if (creationdate != "")
{
cdate = Convert.ToDateTime(creationdate);
if (cdate.ToShortDateString() == DateTime.Now.ToShortDateString())
{
dgvNew.Rows.Add(id, img.Image);
}
}
kid.CloseConnection();
}
}
catch(Exception ex)
{
}
}
示例3: frmLogin_Load
private void frmLogin_Load(object sender, EventArgs e)
{
js = new Connector(AccessRegistryTool.ReadValue("DBServer"),"Kids_Checkin","kidschurch","[email protected]");
icon.Icon = new Icon(Application.StartupPath + @"\kids-icon.ico");
icon.Visible = true;
txtRoom.Text = this.Tag.ToString();
lblConnected.Text = "Connected To: " + AccessRegistryTool.ReadValue("DBServer");
fldRoomID = js.Lookup("fldID", "tblRoom", "fldRoom='" + txtRoom.Text + "'");
string eID = js.Lookup("fldID", "tblCustomizedEvent", "fldEventCode='" + this.Text + "'");
lblTotal.Text = js.Lookup("fldMaxCapacity", "tblCustomizedEventRooms", "fldRoomID='" + fldRoomID + "' AND fldCEventID='" + eID + "'");
txtAge1.Text = js.Lookup("fldAgeFrom", "tblCustomizedEventRooms", "fldRoomID='" + fldRoomID + "' AND fldCEventID='" + eID + "'");
txtAge2.Text = js.Lookup("fldAgeTo", "tblCustomizedEventRooms", "fldRoomID='" + fldRoomID + "' AND fldCEventID='" + eID + "'");
fldGroupID = js.Lookup("fldID","tblGroup","fldAgeFrom='" + txtAge1.Text + "' AND fldAgeTo='" + txtAge2.Text + "'");
if(Convert.ToInt32(txtAge1.Text)< 7)
{
btnAddPoints.Enabled = false;
}
string timetoday = DateTime.Now.ToString("hh:mm tt");
string q = "SELECT * FROM tblEvent WHERE fldRegistrationTime <= convert(time,'" + timetoday + "') AND fldEndTime >=convert(time,'" + timetoday + "')";
js.ExecuteQuery(q);
js.RiD.Read();
lblNotification.Text = "";
if (js.RiD.HasRows)
{
fldEventID = "" + js.RiD["fldID"].ToString();
txtService.Text = js.RiD["fldEventTitle"].ToString();
LoadAttendance();
LoadBirthdays();
LoadNewComer();
LoadVolunteer();
dgvAttendance_CellContentClick(null,null);
}
else
{
js.showExclamation("Cannot open an event yet!, Please try again later");
frmSystemOptions frm = new frmSystemOptions();
frm.Show();
Close();
return;
}
js.CloseConnection();
StartReader();
string mode = AccessRegistryTool.ReadValue("RegMode");
if(mode=="Barcode")
{
tmrReader.Enabled = false;
//rbBarcode_CheckedChanged(null, null);
}
else
{
tmrReader.Enabled = true;
}
//this.BackgroundImage = Image.FromFile(Application.StartupPath + "/Pictures/kids back.jpg");
}