Advertisement
| 10.04.2008 at 07:46PM PDT, ID: 23788101 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: |
private void tmrCheck_Tick(object sender, EventArgs e)
{
// This opens the database.
string conString = "Provider=Microsoft.Jet.OLEDB.4.0;"
+ "Data Source=\\\\DPR\\micromain_database\\msData_2.mdb";
OleDbConnection msData_2Connection = new OleDbConnection(conString);
// This creates the SELECT statement.
string selectStatement = "SELECT MAX(Created) AS MaxOfCreated FROM tblWO";
OleDbCommand objCmdSelect = new OleDbCommand(selectStatement, msData_2Connection);
OleDbDataAdapter objAdapter1 = new OleDbDataAdapter();
objAdapter1.SelectCommand = objCmdSelect;
DataSet objDataset1 = new DataSet();
objAdapter1.Fill(objDataset1);
// This turns the result of the query into a string.
string strResult = objDataset1.Tables[0].Rows[objDataset1.Tables[0].Rows.Count - 1]["MaxOfCreated"].ToString();
// This turns the result of the query into a DateTime.
DateTime dtResult = DateTime.Parse(strResult);
// This sets a variable with the current time.
DateTime dtToday = DateTime.Now;
// This sets a variable for five minutes ago by subtracting 5 from dtToday.
DateTime dtFiveMinutesAgo;
dtFiveMinutesAgo = dtToday.AddMinutes(-5);
// This compares dtResult to dtFiveMinutesAgo.
if (dtResult > dtFiveMinutesAgo)
{
MessageBox.Show(this, "New work orders created!", "MicroMain Alert!", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
// This prints the result in the textbox.
textBox1.Text = strResult;
// This prints the time of the check in the other textbox.
DateTime dtNow = DateTime.Now;
string strNow = dtNow.ToString();
textBox2.Text = strNow;
// This creates the SELECT statement for the asset.
string selectStatement2 = "SELECT MAX(Asset) AS LastAsset FROM tblWO GROUP BY Created";
OleDbCommand objCmdSelect2 = new OleDbCommand(selectStatement2, msData_2Connection);
OleDbDataAdapter objAdapter2 = new OleDbDataAdapter();
objAdapter2.SelectCommand = objCmdSelect2;
DataSet objDataset2 = new DataSet();
objAdapter2.Fill(objDataset2);
// This turns the other query result into a string.
string strResultAsset = objDataset2.Tables[0].Rows[objDataset2.Tables[0].Rows.Count - 1]["LastAsset"].ToString();
//This prints that result in a textbox.
textBox3.Text = strResultAsset;
// Close the connection.
msData_2Connection.Close();
}
|
Advertisement