本文整理汇总了C#中MySql.Data.MySqlClient.MySqlDataAdapter.FillAsync方法的典型用法代码示例。如果您正苦于以下问题:C# MySqlDataAdapter.FillAsync方法的具体用法?C# MySqlDataAdapter.FillAsync怎么用?C# MySqlDataAdapter.FillAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MySql.Data.MySqlClient.MySqlDataAdapter
的用法示例。
在下文中一共展示了MySqlDataAdapter.FillAsync方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getCallsFromDB
private async void getCallsFromDB()
{
dataFromDB = new DataTable();
string preparedquery = "SELECT * FROM calls WHERE tech='" + ICResponse.Properties.Settings.Default.AgentFirstName + " " + ICResponse.Properties.Settings.Default.AgentLastName + "' OR tech='" + ICResponse.Properties.Settings.Default.LoginUsername + "' ORDER BY ticketID DESC LIMIT 100";
using (dbConn = new MySqlConnection("Server=" + ICResponse.Properties.Settings.Default.DBServer +
";Database=" + ICResponse.Properties.Settings.Default.DBName +
";Uid=" + ICResponse.Properties.Settings.Default.DBUser +
";Pwd=" + ICResponse.Properties.Settings.Default.DBPass + ";"))
{
await dbConn.OpenAsync();
}
using (dbDataAdapter = new MySqlDataAdapter(preparedquery, dbConn))
{
await dbDataAdapter.FillAsync(dataFromDB);
}
MyCallsDataGrid.ItemsSource = dataFromDB.DefaultView;
dbConn.Close();
}
示例2: GetOverViewCalls
private async void GetOverViewCalls()
{
try
{
DataTable dataFromDB = new DataTable();
using (MySqlConnection dbConn = new MySqlConnection("Server=" + ICResponse.Properties.Settings.Default.DBServer +
";Database=" + ICResponse.Properties.Settings.Default.DBName +
";Uid=" + ICResponse.Properties.Settings.Default.DBUser +
";Pwd=" + ICResponse.Properties.Settings.Default.DBPass +
";Convert Zero Datetime=True;"))
{
using (MySqlDataAdapter dbDataAdapter = new MySqlDataAdapter(ICResponse.Properties.Settings.Default.GetOverview, dbConn))
{
dbConn.Open();
await dbDataAdapter.FillAsync(dataFromDB);
OverViewCallsGrid.ItemsSource = dataFromDB.DefaultView;
dbDataAdapter.Dispose();
}
dbConn.Close();
}
}
catch (MySqlException me)
{
System.Diagnostics.Debug.WriteLine(me);
throw;
}
}
示例3: btnExportCalls_Click_1
private async void btnExportCalls_Click_1(object sender, RoutedEventArgs e)
{
if (begindateforpicker.Equals("") || enddateforpicker.Equals(""))
{
ModernDialog msgbox = new ModernDialog();
msgbox.Title = "Pick Date Range";
msgbox.Content = "Please select a range of dates.";
msgbox.Buttons = new[] { msgbox.OkButton };
msgbox.ShowDialog();
}
else
{
string reportpath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
StringBuilder reportbuilder = new StringBuilder();
StringBuilder vmbuilder = new StringBuilder();
int i = 0;
int contactedcounter = 0;
//int voicemailcounter = 0;
string datecolumnvalue = string.Empty;
string monthformat = string.Empty;
string finalmonthformat = string.Empty;
string preparedquery = "SELECT * FROM `calls` WHERE tech='" + ICResponse.Properties.Settings.Default.AgentFirstName
+ " "
+ ICResponse.Properties.Settings.Default.AgentLastName
+ "' OR tech='"
+ ICResponse.Properties.Settings.Default.LoginUsername
+ "'AND date BETWEEN '"
+ begindateforpicker
+ "' AND '"
+ enddateforpicker + "'";
dataFromDB.Clear();
dataFromDB = new DataTable();
using (dbConn = new MySqlConnection("Server=" + ICResponse.Properties.Settings.Default.DBServer +
";Database=" + ICResponse.Properties.Settings.Default.DBName +
";Uid=" + ICResponse.Properties.Settings.Default.DBUser +
";Pwd=" + ICResponse.Properties.Settings.Default.DBPass + ";"))
{
await dbConn.OpenAsync();
}
using (dbDataAdapter = new MySqlDataAdapter(preparedquery, dbConn))
{
await dbDataAdapter.FillAsync(dataFromDB);
}
MyCallsDataGrid.ItemsSource = dataFromDB.DefaultView;
foreach (DataRow dRow in dataFromDB.Rows)
{
i++;
string BBcompany = String.Empty;
string BBcontact = String.Empty;
string BBduration = String.Empty;
//if (dRow["voicemail"].ToString().Equals("Voicemail"))
//{
// BBcompany = dRow["company"].ToString();
// BBcontact = dRow["contact"].ToString();
// BBduration = dRow["duration"].ToString();
// vmbuilder.AppendLine(dRow["ticketID"].ToString());
// vmbuilder.AppendLine(dRow["origin"].ToString());
// vmbuilder.AppendLine("[b]" + BBcompany + "[/b]"); // [b]
// vmbuilder.AppendLine("[i]" + BBcontact + "[/i]"); // [i]
// vmbuilder.AppendLine(dRow["phone"].ToString());
// datecolumnvalue = dRow["date"].ToString();
// monthformat = datecolumnvalue.Replace("12:00:00 AM", "");
// vmbuilder.AppendLine(monthformat);
// vmbuilder.AppendLine(dRow["startTime"].ToString());
// vmbuilder.AppendLine(dRow["stopTime"].ToString());
// vmbuilder.AppendLine("[u]" + BBduration + "[/u]"); // [u]
// vmbuilder.AppendLine(dRow["voicemail"].ToString());
// vmbuilder.AppendLine();
// vmbuilder.AppendLine();
// voicemailcounter++;
//}
//else
//{
BBcompany = dRow["company"].ToString();
BBcontact = dRow["contact"].ToString();
BBduration = dRow["duration"].ToString();
reportbuilder.AppendLine(dRow["ticketID"].ToString());
//reportbuilder.AppendLine(dRow["origin"].ToString());
reportbuilder.AppendLine("[b]" + BBcompany + "[/b]"); // [b]
reportbuilder.AppendLine("[i]" + BBcontact + "[/i]"); // [i]
reportbuilder.AppendLine(dRow["phone"].ToString());
datecolumnvalue = dRow["date"].ToString();
monthformat = datecolumnvalue.Replace("12:00:00 AM", "");
reportbuilder.AppendLine(monthformat);
reportbuilder.AppendLine(dRow["startTime"].ToString());
reportbuilder.AppendLine(dRow["stopTime"].ToString());
reportbuilder.AppendLine("[u]" + BBduration + "[/u]"); // [u]
//reportbuilder.AppendLine(dRow["voicemail"].ToString());
reportbuilder.AppendLine(dRow["issue"].ToString());
//.........这里部分代码省略.........