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


C# MySqlDataReader.GetStringNullable方法代碼示例

本文整理匯總了C#中MySql.Data.MySqlClient.MySqlDataReader.GetStringNullable方法的典型用法代碼示例。如果您正苦於以下問題:C# MySqlDataReader.GetStringNullable方法的具體用法?C# MySqlDataReader.GetStringNullable怎麽用?C# MySqlDataReader.GetStringNullable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MySql.Data.MySqlClient.MySqlDataReader的用法示例。


在下文中一共展示了MySqlDataReader.GetStringNullable方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: LoadContact

        private Contact LoadContact(MySqlDataReader reader)
        {
            Contact c = new Contact();
            c.Id = (int)reader["id"];
            c.SourceId = (int)(long)reader["sourceId"];
            c.LastModified = (DateTime)reader["lastModified"];
            c.StartTime = (DateTime)reader["startTime"];
            c.EndTime = (DateTime)reader["endTime"];
            c.Callsign = (string)reader["callsign"];
            c.Station = reader["station"] as string;
            c.Operator = reader["operator"] as string;
            c.Band = BandHelper.Parse(reader["band"] as string);
            c.Mode = ModeHelper.Parse(reader["mode"] as string);
            c.Frequency = (long)reader["frequency"];
            c.ReportReceived = (reader["reportRx"] as string) ?? string.Empty;
            c.ReportSent = (reader["reportTx"] as string) ?? string.Empty;
            c.Notes = (reader["notes"] as string) ?? string.Empty;
            int serialReceived;
            int serialSent;
            int.TryParse(reader["serialReceived"] as string, out serialReceived);
            int.TryParse(reader["serialSent"] as string, out serialSent);
            c.SerialReceived = serialReceived;
            c.SerialSent = serialSent;
            c.QslRxDate = reader.GetDateTimeNullable("qslRxDate");
            c.QslTxDate = reader.GetDateTimeNullable("qslTxDate");
            c.QslMethod = reader["qslMethod"] as string;
            c.LocationID = (int)reader["location"];
            c.SatelliteName = reader.GetStringNullable("satellitename");
            c.SatelliteMode = reader.GetStringNullable("satellitemode");

            // Optional stuff below here...
            string locatorString = reader["locator"] as string;
            if (locatorString != null)
                c.LocatorReceived = new Locator(locatorString);

            return c;
        }
開發者ID:rmc47,項目名稱:CamLog,代碼行數:37,代碼來源:ContactStore.cs


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