當前位置: 首頁>>代碼示例>>C#>>正文


C# MySqlDataAdapter.FillAsync方法代碼示例

本文整理匯總了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();
        }
開發者ID:Toffer305,項目名稱:icresponse2,代碼行數:21,代碼來源:MyCalls.xaml.cs

示例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;                
     }
 }
開發者ID:Toffer305,項目名稱:icresponse2,代碼行數:27,代碼來源:OverviewStatus.xaml.cs

示例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());
//.........這裏部分代碼省略.........
開發者ID:Toffer305,項目名稱:icresponse2,代碼行數:101,代碼來源:MyCalls.xaml.cs


注:本文中的MySql.Data.MySqlClient.MySqlDataAdapter.FillAsync方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。