本文整理汇总了C#中Connector.ExecuteNonQuery方法的典型用法代码示例。如果您正苦于以下问题:C# Connector.ExecuteNonQuery方法的具体用法?C# Connector.ExecuteNonQuery怎么用?C# Connector.ExecuteNonQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Connector
的用法示例。
在下文中一共展示了Connector.ExecuteNonQuery方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ValidateCheckin2
private bool ValidateCheckin2(string BarCode, out string kidid)
{
string kid = js.Lookup("fldID", "tblKids", "fldStudentID='" + BarCode + "'");
string id = "";
if (kid=="")
{
Connector con = new Connector(KIDS_CheckIn_System.Properties.Settings.Default.Server,"Kids_Checkin","kidschurch","[email protected]");
kid = con.Lookup("fldID", "tblKids", "fldStudentID='" + BarCode + "'");
//UPDATE Local Database;
string qry = "SELECT * FROM tblKids WHERE fldID='" + kid + "'";
con.ExecuteQuery(qry);
con.RiD.Read();
string studentID = "";
string firstname = "";
string lastname = "";
string middle = "";
string nickname = "";
string birthday = "";
string church = "";
string picture = "";
string nationality = "";
string gender = "";
string allergies = "";
string fldFirstName = "";
string fldLastName = "";
string fldRelationship = "";
string fldPicture = "";
string fldEmail = "";
if(con.RiD.HasRows)
{
studentID = "" + con.RiD["fldStudentID"];
firstname = "" + con.RiD["fldFirstName"];
lastname = "" + con.RiD["fldLastName"];
middle = "" + con.RiD["fldMiddleName"];
nickname = "" + con.RiD["fldNickName"];
birthday = "" + con.RiD["fldBirthday"];
church = "" + con.RiD["fldChurch"];
picture = "" + con.RiD["fldPicture"];
nationality = "" + con.RiD["fldNationality"];
gender = "" + con.RiD["fldGender"];
allergies = "" + con.RiD["fldAllergies"];
}
string fID = con.Lookup("fldFetcherID", "tblKidFetcher", "fldKidID='" + kid + "'");
qry = "SELECT * FROM tblFetcher WHERE fldID='" + fID + "'";
con.ExecuteQuery(qry);
con.RiD.Read();
if(con.RiD.HasRows)
{
fldFirstName = "" + con.RiD["fldFirstName"];
fldLastName = "" + con.RiD["fldLastName"];
fldRelationship = "" + con.RiD["fldRelationship"];
fldPicture = "" + con.RiD["fldPicture"];
fldEmail = "" + con.RiD["fldEmail"];
}
js = new Connector(AccessRegistryTool.ReadValue("DBServer"), "Kids_Checkin", "kidschurch", "[email protected]");
string qry1 = "INSERT INTO tblKids(fldStudentID,fldFirstName,fldLastName,fldNickName,fldBirthday,fldChurch,fldPicture,fldNationality,fldGender,fldAllergies) VALUES('" +
studentID + "','" + firstname + "','" + lastname + "','" + nickname + "','" + birthday + "','" + church + "','" + picture + "','" + nationality + "','" + gender + "','" + allergies + "')" ;
js.ExecuteNonQuery(qry1);
string kcID = js.Lookup("fldID", "tblKids", "fldStudentID='" + studentID + "'");
string qry2 = "INSERT INTO tblFetcher(fldFirstName,fldLastName,fldRelationship,fldPicture,fldEmail) VALUES('" +
fldFirstName + "','" + fldLastName + "','" + fldRelationship + "','" + fldPicture + "','" + fldEmail + "')";
js.ExecuteNonQuery(qry2);
string fetcher = js.Lookup("fldID", "tblFetcher", "fldPicture='" + fldPicture + "' AND fldLastName='" + fldLastName + "'");
string qry3 = "INSERT INTO tblKidFetcher(fldKidID,fldFetcherID) VALUES('" + kcID + "','" + fetcher + "')";
js.ExecuteNonQuery(qry3);
kid = kcID;
pbLoading.Visible = true;
if (Properties.Settings.Default.PairedDevices != "")
{
string[] devices = Properties.Settings.Default.PairedDevices.Split(char.Parse(","));
if (devices[0] == "")
{
string device = Properties.Settings.Default.PairedDevices;
string[] properties = device.Split(char.Parse("|"));
//.........这里部分代码省略.........
示例2: tmrReader_Tick
//.........这里部分代码省略.........
js.ExecuteQuery(q);
if(js.RiD.HasRows)
{
lblNotification.Text = "Already logged in";
return;
}
txtName.Text = js.Lookup("fldFirstName + ' ' + fldLastName", "tblVolunteers", "fldID ='" + id + "'");
if (System.IO.File.Exists(AccessRegistryTool.ReadValue("PicPath") + @"\volunteer\" + js.Lookup("fldPicture", "tblVolunteers", "fldID ='" + id + "'")))
{
pbImageKid.Image = Image.FromFile(AccessRegistryTool.ReadValue("PicPath") + @"\volunteer\" + js.Lookup("fldPicture", "tblVolunteers", "fldID ='" + id + "'"));
}
else
{
pbImageKid.Image = Image.FromFile(AccessRegistryTool.ReadValue("PicPath") + "\\download.jpg");
}
txtNFC.Text = tmpStr;
txtBarcode.Text = "N/A";
txtBirthday.Text = "N/A";
txtAge.Text = "N/A";
txtAllergies.Text = "N/A";
lblNotification.Text = "Welcome " + txtName.Text;
sql = "INSERT INTO tblVolunteerAttendance(fldVolunteerID,fldLoginDateTime) VALUES('" + id + "','" + DateTime.Now.ToString() + "')";
js = new Connector(AccessRegistryTool.ReadValue("DBServer"), "Kids_Checkin", "kidschurch", "[email protected]");
js.ExecuteNonQuery(sql);
js = new Connector(Properties.Settings.Default.Server, "Kids_Checkin", "kidschurch", "[email protected]");
js.ExecuteNonQuery(sql);
}
else
{
lblNotification.Text = "Not Assigned to this SERVICE";
}
LoadVolunteer();
return;
}
else
{
if (ValidateCheckin(tmpStr, out kidid, out value))
{
if (kidid == "")
{
lblNotification.ForeColor = System.Drawing.Color.Red;
lblNotification.Text = "No Record Found";
return;
}
if (lblCount.Text == lblTotal.Text)
{
string id = js.Lookup("fldID", "tblCustomizedEvent", "fldEventCode='" + this.Text + "'");
string qry = "SELECT er.fldRoomID,r.fldRoom FROM tblCustomizedEventRooms er " +
" LEFT OUTER JOIN tblRoom r on r.fldID=er.fldRoomID" +
" WHERE er.fldMaxCapacity>(SELECT Count(*) FROM tblAttendance WHERE fldRoomID=er.fldRoomID AND fldLoginDateTime BETWEEN '" + DateTime.Now.ToShortDateString() + " 00:00:00' AND '" + DateTime.Now.ToShortDateString() + " 23:59:59' AND fldEventID='" + fldEventID + "')" +
示例3: ValidateCheckin
private bool ValidateCheckin(string NFC, out string kidid,out string bcode)
{
string kid = js.Lookup("fldKidID", "tblKidsNFC", "fldNFCCode='" + NFC + "'");
string barcode = js.Lookup("fldStudentID", "tblKids", "fldID='" + kid + "'");
string id = "";
Connector con = new Connector(Properties.Settings.Default.Server, "Kids_Checkin", "kidschurch", "[email protected]");
if(kid=="" && barcode=="")
{
kid = con.Lookup("fldKidID", "tblKidsNFC", "fldNFCCode='" + NFC + "'");
barcode = con.Lookup("fldStudentID", "tblKids", "fldID='" + kid + "'");
//Update Local Database
js = new Connector(AccessRegistryTool.ReadValue("DBServer"), "Kids_Checkin", "kidschurch", "[email protected]");
string kcID = js.Lookup("fldID", "tblKids", "fldStudentID='" + barcode + "'");
if(kcID!="")
{
string qry = "INSERT INTO tblKidsNFC(fldNFCCode,fldKidID) VALUES('" + NFC + "','" + kcID + "')";
js.ExecuteQuery(qry);
}
kid = kcID;
pbLoading.Visible = true;
if (Properties.Settings.Default.PairedDevices != "")
{
string[] devices = Properties.Settings.Default.PairedDevices.Split(char.Parse(","));
if (devices[0] == null)
{
string device = Properties.Settings.Default.PairedDevices;
string[] properties = device.Split(char.Parse("|"));
try
{
Application.DoEvents();
Connector paired = new Connector(properties[1], "Kids_Checkin", "kidschurch", "[email protected]");
kcID = paired.Lookup("fldID", "tblKids", "fldStudentID='" + barcode + "'");
string qry = "INSERT INTO tblKidsNFC(fldNFCCode,fldKidID) VALUES('" + NFC + "','" + kcID + "')";
paired.ExecuteNonQuery(qry);
//paired.CloseConnection();
}
catch (Exception ex)
{
errBallontoolTip("Kids Checkin System", ex.Message);
//paired.CloseConnection();
}
}
for (int i = 0; i <= (devices.Length - 1); i++)
{
string device = devices[i];
string[] properties = device.Split(char.Parse("|"));
try
{
Application.DoEvents();
Connector paired = new Connector(properties[1], "Kids_Checkin", "kidschurch", "[email protected]");
kcID = paired.Lookup("fldID", "tblKids", "fldStudentID='" + barcode + "'");
string qry = "INSERT INTO tblKidsNFC(fldNFCCode,fldKidID) VALUES('" + NFC + "','" + kcID + "')";
paired.ExecuteNonQuery(qry);
//paired.CloseConnection();
}
catch (Exception ex)
{
errBallontoolTip("Kids Checkin System", ex.Message);
//paired.CloseConnection();
pbLoading.Visible = false;
}
}
}
}
js = new Connector(AccessRegistryTool.ReadValue("DBServer"), "Kids_Checkin", "kidschurch", "[email protected]");
id = js.Lookup("fldID", "tblAttendance", "fldKidsID='" + barcode + "' AND fldLoginDateTime BETWEEN '" + DateTime.Now.AddDays(-1).ToShortDateString() + " 00:00:00' AND '" + DateTime.Now.ToShortDateString() + " 23:59:59'");
if (id == "")
{
kidid = kid;
bcode = barcode;
return true;
//.........这里部分代码省略.........
示例4: SaveCheckin
//.........这里部分代码省略.........
{
group = 2;
}
else if ((Convert.ToDecimal(age) >= 3) && (Convert.ToDecimal(age) <= 4))
{
group =3;
}
else if ((Convert.ToDecimal(age) >= 5) && (Convert.ToDecimal(age) <= 6))
{
group = 4;
}
else if ((Convert.ToDecimal(age) >= 7) && (Convert.ToDecimal(age) <= 9))
{
group = 5;
}
else if ((Convert.ToDecimal(age) >= 10) && (Convert.ToDecimal(age) <= 12))
{
group =6;
}
else
{
group = 0;
}
string q = "INSERT INTO tblAttendance(fldRoomID,fldChurch,fldLoginDateTime,fldKidsID,fldEventID,fldGroupID,fldAge) VALUES('" + roomid + "','" + 1 + "','" + DateTime.Now.ToString() + "','" + txtBarcode.Text + "','" + fldEventID + "','" + group + "','" + age + "')";
//string q = "INSERT INTO tblAttendance(fldRoomID,fldChurch,fldLoginDateTime,fldKidsID,fldEventID) VALUES('" + roomid + "','" + 1 + "','" + DateTime.Now.ToString() + "','" + kidid + "','" + fldEventID + "')";
js.ExecuteNonQuery(q);
dgvAttendance.Rows.Add(kidid, img.Image);
pbLoading.Visible = true;
if (Properties.Settings.Default.PairedDevices != "")
{
string[] devices = Properties.Settings.Default.PairedDevices.Split(char.Parse(","));
if (devices[0] == "")
{
string device = Properties.Settings.Default.PairedDevices;
string[] properties = device.Split(char.Parse("|"));
Connector con = new Connector(properties[1], "Kids_Checkin", "kidschurch", "[email protected]");
try
{
Application.DoEvents();
con.ExecuteNonQuery(q);
//con.CloseConnection();
}
catch(Exception ex)
{
errBallontoolTip("Kids Checkin System", ex.Message);
//con.CloseConnection();
}
txtRoom.Text = room;
this.Tag = room;
frmLogin_Load(null, null);
示例5: pbOverride_Click
//.........这里部分代码省略.........
}
else if ((Convert.ToDecimal(age) >= 2) && (Convert.ToDecimal(age) < 3))
{
group = 2;
}
else if ((Convert.ToDecimal(age) >= 3) && (Convert.ToDecimal(age) <= 4))
{
group = 3;
}
else if ((Convert.ToDecimal(age) >= 5) && (Convert.ToDecimal(age) <= 6))
{
group = 4;
}
else if ((Convert.ToDecimal(age) >= 7) && (Convert.ToDecimal(age) <= 9))
{
group = 5;
}
else if ((Convert.ToDecimal(age) >= 10) && (Convert.ToDecimal(age) <= 12))
{
group = 6;
}
else
{
group = 0;
}
string q = "INSERT INTO tblAttendance(fldRoomID,fldChurch,fldLoginDateTime,fldKidsID,fldEventID,fldGroupID,fldAge) VALUES('" + roomid + "','" + 1 + "','" + DateTime.Now.ToString() + "','" + txtBarcode.Text + "','" + fldEventID + "','" + group + "','" + age + "')";
//string q = "INSERT INTO tblAttendance(fldRoomID,fldChurch,fldLoginDateTime,fldKidsID,fldEventID) VALUES('" + roomid + "','" + 1 + "','" + DateTime.Now.ToString() + "','" + kidid + "','" + fldEventID + "')";
js.ExecuteNonQuery(q);
pbLoading.Visible = true;
if(Properties.Settings.Default.PairedDevices!="")
{
string[] devices = Properties.Settings.Default.PairedDevices.Split(char.Parse(","));
if (devices[0] == "")
{
string device = Properties.Settings.Default.PairedDevices;
string[] properties = device.Split(char.Parse("|"));
Connector con = new Connector(properties[1],"Kids_Checkin","kidschurch","[email protected]");
try
{
Application.DoEvents();
con.ExecuteNonQuery(q);
}
catch(Exception ex)
{
}
return;
}
for(int i=0;i<=(devices.Length - 1);i++)
{
string device = devices[i];
string[] properties = device.Split(char.Parse("|"));
Connector con = new Connector(properties[1], "Kids_Checkin", "kidschurch", "[email protected]");
try
{
Application.DoEvents();
con.ExecuteNonQuery(q);
}
catch(Exception ex)
{
}
}
}
pbLoading.Visible = false;
thistext = this.Text;
txtRoom.Text = room;
this.Tag = room;
frmLogin_Load(null, null);
lblNotification.ForeColor = System.Drawing.Color.Green;
lblNotification.Text = "Successfully Logged In";
tmrReader.Enabled = true;
pbOverride.Tag = null;
pbOverride.Visible = false;
}
示例6: ExecuteNonQuery
public int ExecuteNonQuery(string query, System.Data.SqlClient.SqlParameter[] parameters, Connector cnn)
{
return cnn.ExecuteNonQuery(query, parameters);
}
示例7: CheckOut
private void CheckOut(string attendanceID)
{
js = new Connector(AccessRegistryTool.ReadValue("DBServer"), "Kids_Checkin", "kidschurch", "[email protected]");
string remarks = js.Lookup("fldRemarks", "tblAttendance", "fldID='" + attendanceID + "'");
string fldKidID = js.Lookup("fldKidsID", "tblAttendance", "fldID='" + attendanceID + "'");
int p = 0;
int fldPoints = 0;
if(int.TryParse(js.Lookup("fldPoints","tblKids"," fldStudentID='" + fldKidID + "'"),out p))
{
fldPoints = p + 50;
}
else
{
fldPoints = 50;
}
if(fromNFC==true)
{
string qq = "UPDATE tblKids SET fldPoints='" + fldPoints + "' WHERE fldStudentID='" + fldKidID + "'";
js.ExecuteNonQuery(qq);
}
remarks += ";Logged out: " + DateTime.Now.ToString();
string q = "Update tblAttendance SET fldLogoutDateTime='" + DateTime.Now.ToString() + "',fldRemarks='" + remarks + "' WHERE fldLoginDateTime BETWEEN '" + DateTime.Now.ToString("MM/dd/yyyy") + " 00:00:00' AND '" + DateTime.Now.ToString("MM/dd/yyyy") + " 23:59:59' AND fldKidsID='" +fldKidID + "'";
js.ExecuteNonQuery(q);
pbLoading.Visible = true;
if (Properties.Settings.Default.PairedDevices != "")
{
string[] devices = Properties.Settings.Default.PairedDevices.Split(char.Parse(","));
if (devices[0] == "")
{
string device = Properties.Settings.Default.PairedDevices;
string[] properties = device.Split(char.Parse("|"));
Connector con = new Connector(properties[1], "Kids_Checkin", "kidschurch", "[email protected]");
try
{
Application.DoEvents();
con.ExecuteNonQuery(q);
}
catch(Exception ex)
{
}
return;
}
for (int i = 0; i <= (devices.Length - 1); i++)
{
string device = devices[i];
string[] properties = device.Split(char.Parse("|"));
Connector con = new Connector(properties[1], "Kids_Checkin", "kidschurch", "[email protected]");
try
{
Application.DoEvents();
con.ExecuteNonQuery(q);
}
catch(Exception ex)
{
}
}
}
//PASS TO SERVER
js = new Connector(AccessRegistryTool.ReadValue("DBServer"), "Kids_Checkin", "kidschurch", "[email protected]");
string query = "SELECT * FROM tblAttendance WHERE fldLoginDateTime BETWEEN '" + DateTime.Now.ToString("MM/dd/yyyy") + " 00:00:00' AND '" + DateTime.Now.ToString("MM/dd/yyyy") + " 23:59:59'" +
" AND fldKidsID='" + fldKidID + "'";
js.ExecuteQuery(query);
js.RiD.Read();
if(js.RiD.HasRows)
{
string fldRoomID = "" + js.RiD["fldRoomID"];
string fldLoginDateTime = "" + js.RiD["fldLoginDateTime"];
string fldLogoutDateTime = "" + js.RiD["fldLogoutDateTime"];
string fldChurch ="" + js.RiD["fldChurch"];
string fldKidsID = "" + js.RiD["fldKidsID"];
string fldRemarks = "" + js.RiD["fldRemarks"];
string fldEventID = js.Lookup("fldEventTitle", "tblEvent", "fldID='" + js.RiD["fldEventID"] + "'");
string fldGroupID ="" + js.RiD["fldGroupID"];
string fldAge = "" + js.RiD["fldAge"];
//.........这里部分代码省略.........
示例8: timer2_Tick
private void timer2_Tick(object sender, EventArgs e)
{
retCode = CardConnect(1);
if (retCode != ModWinsCard.SCARD_S_SUCCESS)
{
//displayOut(5, 0, "No card within range.");
//tsMsg2.Text = "";
return;
}
//CheckCard();
if (CheckCard())
{
//displayOut(5, 0, "Card is detected.");
getParam();
string tmpStr = "";
int indx;
for (indx = 0; indx <= RecvLen - 3; indx++)
{
tmpStr = tmpStr + string.Format("{0:X2}", RecvBuff[indx]);
}
string str = tmpStr.Substring(0, 8);
if (str == "00000000")
{
lblNotification.Text = "Please Try Again";
return;
}
if (isVolunteer(tmpStr))
{
js = new Connector(Properties.Settings.Default.Server, "Kids_Checkin", "kidschurch", "[email protected]");
string vid = js.Lookup("fldID", "tblVolunteers", "fldNFCCode='" + tmpStr + "'");
string sql = "SELECT * FROM tblVolunteerAttendance WHERE fldVolunteerID='" + vid + "' AND fldLoginDateTime BETWEEN '" + DateTime.Now.ToString("MM/dd/yyyy 00:00:00") + "' AND '" + DateTime.Now.ToString("MM/dd/yyyy 23:59:59") + "' AND fldLogoutDateTime IS NULL";
js.ExecuteQuery(sql);
if (js.RiD.Read())
{
string attendanceID = js.RiD["fldID"].ToString();
string picture = js.Lookup("fldPicture", "tblVolunteers", "fldID='" + vid + "'");
lblKName.Text = js.Lookup("fldFirstName + ' ' + fldLastName", "tblVolunteers", "fldID='" + vid + "'");
if (System.IO.File.Exists(AccessRegistryTool.ReadValue("PicPath") + "\\volunteer\\" + picture))
{
pbK1.Image = Image.FromFile(AccessRegistryTool.ReadValue("PicPath") + "\\volunteer\\" + picture);
}
else
{
pbK1.Image = Image.FromFile(AccessRegistryTool.ReadValue("PicPath") + "\\download.jpg");
}
js = new Connector(AccessRegistryTool.ReadValue("DBServer"), "Kids_Checkin", "kidschurch", "[email protected]");
sql = "UPDATE tblVolunteerAttendance SET fldLogoutDateTime='" + DateTime.Now.ToString() + "' WHERE fldID='" + attendanceID + "'";
js.ExecuteNonQuery(sql);
js = new Connector(Properties.Settings.Default.Server, "Kids_Checkin", "kidschurch", "[email protected]");
attendanceID = js.Lookup("fldID", "tblVolunteerAttendance", "fldVolunteerID='" + vid + "' AND fldLoginDateTime BETWEEN '" + DateTime.Now.ToString("MM/dd/yyyy 00:00:00") + "' AND '" + DateTime.Now.ToString("MM/dd/yyyy 23:59:59") + "' AND fldLogoutDateTime IS NULL");
sql = "UPDATE tblVolunteerAttendance SET fldLogoutDateTime='" + DateTime.Now.ToString() + "' WHERE fldID='" + attendanceID + "'";
js.ExecuteNonQuery(sql);
lblNotification.Text = "Volunteer Logged out";
}
return;
}
//tmrReader.Enabled = false;
string id = js.Lookup("fldKidID", "tblKidsNFC", "fldNFCCode='" + tmpStr + "'");
string bc = js.Lookup("fldStudentID", "tblKids", "fldID='" + id + "'");
string q = "SELECT * FROM tblKids WHERE fldID='" + id + "'";
string aID = js.Lookup("fldID", "tblAttendance", "fldKidsID='" + bc + "' AND fldLoginDateTime BETWEEN '" + DateTime.Now.ToShortDateString() + " 00:00:00' AND '" + DateTime.Now.ToShortDateString() + " 23:59:59' AND fldLogoutDateTime IS NULL");
js.ExecuteQuery(q);
js.RiD.Read();
//.........这里部分代码省略.........