当前位置: 首页>>代码示例>>C#>>正文


C# OleDbDataReader.IsDBNull方法代码示例

本文整理汇总了C#中System.Data.OleDb.OleDbDataReader.IsDBNull方法的典型用法代码示例。如果您正苦于以下问题:C# OleDbDataReader.IsDBNull方法的具体用法?C# OleDbDataReader.IsDBNull怎么用?C# OleDbDataReader.IsDBNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Data.OleDb.OleDbDataReader的用法示例。


在下文中一共展示了OleDbDataReader.IsDBNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Advertisement

 public Advertisement(OleDbDataReader reader)
 {
     this.StrId = reader.GetString(0);
     if (!reader.IsDBNull(1))
         this.IntType = reader.GetInt32(1);
     else
         this.IntType = 3;
     if (!reader.IsDBNull(2))
         this.StrContent = reader.GetString(2);
     else
         this.StrContent = "";
 }
开发者ID:vanloc0301,项目名称:ecouponsprinter,代码行数:12,代码来源:DownloadInfo.cs

示例2: Coupon

 public Coupon(OleDbDataReader reader)
 {
     this.StrId = reader.GetString(0);
     if (!reader.IsDBNull(1))
         this.StrSmallImg = reader.GetString(1);
     else
         this.strSmallImg = "";
     if (!reader.IsDBNull(2))
         this.StrLargeImg = reader.GetString(2);
     else
         this.StrLargeImg = "";
     if (!reader.IsDBNull(3))
         this.StrPrintImg = reader.GetString(3);
     else
         this.StrPrintImg = "";
 }
开发者ID:vanloc0301,项目名称:ecouponsprinter,代码行数:16,代码来源:DownloadInfo.cs

示例3: Form1

        public Form1()
        {
            InitializeComponent();
            PC.list = new List<PC>();
            PC.total = new List<PC>();
            data.Columns.Add("Id", "Id");
            data.Columns.Add("PC", "PC");
            data.Columns.Add("Inicio", "Inicio");
            data.Columns.Add("Tiempo", "Tiempo");
            data.Columns.Add("Total", "Total");
            data.Columns[3].Width = 130;
            data.Columns[3].Width = 130;
            r = MSAConnection.read("select * from item");
            while (r.Read())
            {
                String d = "";
                PC p = new PC();
                p.id = r.GetInt32(0);
                p.precio = r.GetInt32(2);
                if (!r.IsDBNull(3))
                {
                    //d = r.GetDateTime(3).ToString();
                    DateTime x = r.GetDateTime(3);
                    d = x.Hour + ":" + x.Minute + ":" + x.Second;
                    p.inicio = r.GetDateTime(3);
                    PC.list.Add(p);
                }
                PC.total.Add(p);
                data.Rows.Add(r.GetInt32(0), r.GetString(1), d);
            }
            //            MessageBox.Show(PC.total.Count + "");

            thetimer.Start();
        }
开发者ID:evilnapsis,项目名称:cibertim-msa,代码行数:34,代码来源:Form1.cs

示例4: GetNullableString

        /////////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////
        private string GetNullableString(OleDbDataReader reader, int col)
        {
            if (reader.IsDBNull(col) == false)
            {
                return reader.GetString(col);
            }

            return null;
        }
开发者ID:akiander,项目名称:December,代码行数:11,代码来源:AccessMembershipProvider.cs

示例5: ReadItem

        private PivotItem ReadItem(OleDbDataReader dataReader, int rowId)
        {
            PivotItem item = new PivotItem(rowId.ToString(), this);

            for (int column = 0; column < dataReader.FieldCount; column++)
            {
                if (dataReader.IsDBNull(column)) continue;

                String columnName = dataReader.GetName(column).ToLowerInvariant();
                String value = dataReader.GetValue(column).ToString();
                if (String.IsNullOrEmpty(value)) continue;

                if (columnName == OleDbSchemaConstants.Item.Name)
                {
                    item.Name = value;
                }
                else if (columnName == OleDbSchemaConstants.Item.Image)
                {
                    String imagePath = UriUtility.ExpandRelativeUri(this.BasePath, value);
                    item.Image = new PivotImage(imagePath);
                }
                else if (columnName == OleDbSchemaConstants.Item.Description)
                {
                    item.Description = value;
                }
                else if (columnName == OleDbSchemaConstants.Item.Href)
                {
                    item.Href = value;
                }
                else if (columnName == OleDbSchemaConstants.Item.RelatedLinks)
                {
                    StringReader valueReader = new StringReader(value);
                    String singleValue = null;
                    while ((singleValue = valueReader.ReadLine()) != null)
                    {
                        String[] parts = singleValue.Split(
                            new String[] { OleDbSchemaConstants.LinkPartDelimiter }, StringSplitOptions.None);
                        if (parts.Length > 0)
                        {
                            String name = null, url = null;
                            if (parts.Length == 1)
                            {
                                url = parts[0];
                            }
                            else if (parts.Length >= 2)
                            {
                                name = parts[0];
                                url = parts[1];
                            }
                            item.AddRelatedLink(new PivotLink(name, url));
                        }
                    }
                }
                else
                {
                    PivotFacetCategory facetCategory = null;
                    foreach (PivotFacetCategory currentFacetCategory in m_facetCategoryMap.Values)
                    {
                        if (columnName == currentFacetCategory.Name.Replace('.', '#').ToLowerInvariant())
                        {
                            facetCategory = currentFacetCategory;
                            break;
                        }
                    }

                    if (facetCategory != null)
                    {
                        item.AddFacetValues(facetCategory.Name, this.SplitJoinedStrings(value).ToArray());
                    }
                }
            }

            return item;
        }
开发者ID:saviourofdp,项目名称:pauthor,代码行数:74,代码来源:OleDbCollectionSource.cs

示例6: CreateFacetCategory

        private PivotFacetCategory CreateFacetCategory(OleDbDataReader dataReader)
        {
            String name = null;
            PivotFacetType type = null;

            for (int column = 0; column < dataReader.FieldCount; column++)
            {
                if (dataReader.IsDBNull(column)) continue;

                String columnName = dataReader.GetName(column).ToLowerInvariant();
                String value = dataReader.GetValue(column).ToString();

                if (columnName == OleDbSchemaConstants.FacetCategory.Name)
                {
                    name = value;
                }
                else if (columnName == OleDbSchemaConstants.FacetCategory.Type)
                {
                    type = PivotFacetType.Parse(value);
                }
            }
            if (name == null) throw new InvalidDataException("Facet Categories data set is missing a Name column");
            if (type == null) throw new InvalidDataException("Facet Categories data set is missing a Type column");
            return new PivotFacetCategory(name, type);
        }
开发者ID:saviourofdp,项目名称:pauthor,代码行数:25,代码来源:OleDbCollectionSource.cs

示例7: DisplayReader

        // Display the result set recursively expanding chapterDepth deep
        public void DisplayReader(OleDbDataReader myDataReader, ref uint count, uint alignment, int chapterDepth)
        {
            try
            {
                // compute alignment
                StringBuilder indent = new StringBuilder((int) alignment);
                indent.Append(' ', (int) alignment);

                while (myDataReader.Read())
                {
                    // add alignment
                    StringBuilder row = new StringBuilder(indent.ToString());

                    // for all columns
                    for (int i = 0; i < myDataReader.FieldCount; i++)
                    {
                        // null columns
                        if (myDataReader.IsDBNull(i))
                        {
                            row.Append("NULL;");
                        }
                        else
                        {

                            //vector columns
                            object[] myArray = myDataReader.GetValue(i) as object[];
                            if (myArray != null)
                            {
                                DisplayValue(myArray, row);
                            }
                            else
                            {
                                //check for chapter columns from "group on" queries
                                if (myDataReader.GetFieldType(i).ToString() != "System.Data.IDataReader")
                                {
                                    //regular columns are displayed here
                                    row.Append(myDataReader.GetValue(i));
                                }
                                else
                                {
                                    //for a chapter column type just display the colum name
                                    row.Append(myDataReader.GetName(i));
                                }
                            }
                            row.Append(';');
                        }
                    }
                    if (chapterDepth >= 0)
                    {
                        this.ScrubberGUIInst.DebugPrint(row.ToString());
                        count++;
                    }
                    // for each chapter column
                    for (int i = 0; i < myDataReader.FieldCount; i++)
                    {
                        if (myDataReader.GetFieldType(i).ToString() == "System.Data.IDataReader")
                        {
                            OleDbDataReader Reader = myDataReader.GetValue(i) as OleDbDataReader;
                            DisplayReader(Reader, ref count, alignment + 8, chapterDepth - 1);
                        }
                    }
                }
            }
            finally
            {
                myDataReader.Close();
                myDataReader.Dispose();
            }
        }
开发者ID:solbirn,项目名称:Scrubber,代码行数:70,代码来源:WindowsSearchCleaner.cs

示例8: Element

        public Element(OleDbDataReader reader)
        {
            this._strName = reader.GetString(1);

            if (!reader.IsDBNull(2))
                this._strLocation = reader.GetString(2);
            else
                this._strLocation = "";

            if (!reader.IsDBNull(3))
                this._strSize = reader.GetString(3);
            else
                this._strSize = "";

            if (!reader.IsDBNull(4))
                this._strBgImage = reader.GetString(4);
            else
                this._strBgImage = "";

            if (!reader.IsDBNull(5))
                this._strFontFamily = reader.GetString(5);
            else
                this._strFontFamily = "";

            if (!reader.IsDBNull(6))
                this._strContent = reader.GetString(6);
            else
                this._strContent = "";

            if (!reader.IsDBNull(7))
                this._intFontSize = reader.GetInt16(7);
            else
                this._intFontSize = 0;

            if (!reader.IsDBNull(8))
                this._strFontColor = reader.GetString(8);
            else
                this._strFontColor = "";

            if (!reader.IsDBNull(9))
                this._strCtlName = reader.GetString(9);
            else
                this._strCtlName = "";
        }
开发者ID:vanloc0301,项目名称:ecouponsprinter,代码行数:44,代码来源:DownloadInfo.cs

示例9: Shop

 public Shop(OleDbDataReader reader)
 {
     this.StrId = reader.GetString(0);
     if (!reader.IsDBNull(1))
         this.StrSmallImg = reader.GetString(1);
     else
         this.StrSmallImg = "";
     if (!reader.IsDBNull(2))
         this.StrLargeImg = reader.GetString(2);
     else
         this.StrLargeImg = "";
 }
开发者ID:vanloc0301,项目名称:ecouponsprinter,代码行数:12,代码来源:DownloadInfo.cs

示例10: DisplayReader

        // Display the result set recursively expanding chapterDepth deep
        static void DisplayReader(OleDbDataReader myDataReader, ref uint count, uint alignment, int chapterDepth)
        {
            try
            {
                // compute alignment
                StringBuilder indent = new StringBuilder((int)alignment);
                indent.Append(' ', (int)alignment);

                while (myDataReader.Read())
                {
                    // add alignment
                    StringBuilder row = new StringBuilder(indent.ToString());

                    // for all columns
                    for (int i = 0; i < myDataReader.FieldCount; i++)
                    {
                        // null columns
                        if (myDataReader.IsDBNull(i))
                        {
                            row.Append("NULL\t");
                        }
                        else
                        {
                            //vector columns
                            object[] myArray = myDataReader.GetValue(i) as object[];
                            if (myArray != null)
                            {
                                DisplayValue(myArray, row);
                            }
                            else
                            {
                                //check for chapter columns from "group on" queries
                                if (myDataReader.GetFieldType(i).ToString() != "System.Data.IDataReader")
                                {
                                    //regular columns are displayed here
                                    //If (OptPath == false) and colName is System.ItemPathDisplay
                                    //We want to skip Display of this Column
                                    if (!(OptPath == false && myDataReader.GetName(i) == "System.ItemPathDisplay"))
                                        row.Append(myDataReader.GetValue(i));
                                }
                                else
                                {
                                    //for a chapter column type just display the colum name
                                    row.Append(myDataReader.GetName(i));
                                }
                            }
                            row.Append('\t');
                        }
                    }
                    if (chapterDepth >= 0)
                    {
                        Console.WriteLine(row.ToString());
                        count++;
                    }
                    // for each chapter column
                    for (int i = 0; i < myDataReader.FieldCount; i++)
                    {
                        if (myDataReader.GetFieldType(i).ToString() == "System.Data.IDataReader")
                        {
                            OleDbDataReader Reader = myDataReader.GetValue(i) as OleDbDataReader;
                            DisplayReader(Reader, ref count, alignment + 8, chapterDepth - 1);
                        }
                    }
                }
            }
            finally
            {
                myDataReader.Close();
                myDataReader.Dispose();
            }
        }
开发者ID:Grynn,项目名称:locate,代码行数:72,代码来源:Program.cs

示例11: AddFromReader

  public void AddFromReader(OleDbDataReader reader, bool addSpace)
  {
    do
    {
      if (reader.HasRows)
      {
        HtmlGenericControl resultSetDiv = CreateDiv("ResultSet");
        _container.Controls.Add(resultSetDiv);

        int headerColumn = reader.GetColumnIndex("Header");
        string lastHeader = null;
        
        int subheaderColumn = reader.GetColumnIndex("Subheader");
        string lastSubHeader = null;
        
        int lastColumn = reader.FieldCount - 1;

        for (int i = 0; i < 2; ++i)
        {
          if (lastColumn == headerColumn || lastColumn == subheaderColumn)
          {
            lastColumn -= 1;
          }
        }

        while (reader.Read())
        {
          HtmlGenericControl rowSetDiv = CreateDiv("RowSet");
          resultSetDiv.Controls.Add(rowSetDiv);

          bool headerAdded = false;
          bool subheaderAdded = false;

          if (headerColumn >= 0 && !reader.IsDBNull(headerColumn))
          {
            string header = reader.GetValue(headerColumn).ToString();
            headerAdded = header != lastHeader;

            if (headerAdded)
            {
              HtmlGenericControl headerDiv = CreateDiv("RowSetHeader", header);
              rowSetDiv.Controls.Add(headerDiv);
              lastHeader = header;
            }
          }

          if (subheaderColumn >= 0 && !reader.IsDBNull(subheaderColumn))
          {
            string subheader = reader.GetValue(subheaderColumn).ToString();
            subheaderAdded = subheader != lastSubHeader;

            if (subheaderAdded)
            {
              if (headerAdded && addSpace)
              {
                AddSpace(rowSetDiv, "Space2");
              }

              HtmlGenericControl subheaderDiv = CreateDiv("RowSetSubheader", subheader);
              rowSetDiv.Controls.Add(subheaderDiv);
              lastSubHeader = subheader;
            }
          }

          if (lastColumn < 0)
          {
            if (addSpace)
            {
              AddSpace(rowSetDiv, "Space2");
            }
          }
          else
          {
            if ((headerAdded || subheaderAdded) && addSpace)
            {
              AddSpace(rowSetDiv, "Space2");
            }

            for (int i = 0; i < reader.FieldCount; ++i)
            {
              if (i != headerColumn && i != subheaderColumn)
              {
                HtmlGenericControl valueSetDiv = CreateDiv("ValueSet");
                rowSetDiv.Controls.Add(valueSetDiv);

                HtmlGenericControl labelDiv = CreateDiv("Label", reader.GetName(i));
                valueSetDiv.Controls.Add(labelDiv);

                if (addSpace)
                {
                  HtmlGenericControl separatorDiv = CreateDiv("Separator", "");
                  valueSetDiv.Controls.Add(separatorDiv);
                }

                HtmlGenericControl valueDiv = CreateValueDiv(!reader.IsDBNull(i) ? reader.GetValue(i) : null);
                valueSetDiv.Controls.Add(valueDiv);

                if (i < lastColumn && addSpace)
                {
                  AddSpace(rowSetDiv, "Space1");
//.........这里部分代码省略.........
开发者ID:ClaireBrill,项目名称:GPV,代码行数:101,代码来源:DataListBuilder.cs

示例12: GenerateRecordID

 void GenerateRecordID()
 {
     string strSQL;
     OleDbDataReader myReader;
     OleDbCommand myCom;
     strSQL = "SELECT MAX(tblProfile.PROFILE_ID) FROM tblProfile;";
     myCom = this.refConn.CreateCommand();
     myCom.CommandText = strSQL;
     myReader = myCom.ExecuteReader();
     if (myReader.HasRows)
     {
         while (myReader.Read())
         {
             if ( myReader.IsDBNull(0) )
                 txtRecordID.Text = "1";
             else
                 txtRecordID.Text= (myReader.GetInt32(0)+1).ToString();
         }
     }else txtRecordID.Text = "1";
     myReader.Close();
 }
开发者ID:VinhNT,项目名称:MedicineCenter,代码行数:21,代码来源:frmPatientRecord.cs

示例13: setReferenceConnectNLoadData

        public void setReferenceConnectNLoadData(ref OleDbConnection refParent, ref MemoryStream ReportDefinition, ref Image imgHeader, string ReportTitle)
        {
            string strSQL;
            int pType, cType;
            int YPoint, i;
            Button btnRefTmp;
            ComboBox cboShow_Diag = new ComboBox();
            cboShow_Treatment = new ComboBox();
            Label lblShow_Diag;

            OleDbCommand myCom = new OleDbCommand();
            OleDbDataReader myReader;
            pType = -1;
            this.refConn = refParent;
            this.refImageHeader = CopyImage(imgHeader);
            this.ReportTitle = ReportTitle;
            strSQL = "SELECT tblMasterInfor.M_ID, tblMasterInfor.M_Type, tblMasterInfor.M_Name, tblDetailsInfor.Details_ID, tblDetailsInfor.Details_Content FROM tblMasterInfor LEFT JOIN tblDetailsInfor ON tblMasterInfor.M_ID = tblDetailsInfor.Mas_ID WHERE tblMasterInfor.M_Type=" + frmAddNewMasterItem.ENUM_INTEGER_CATOGERY_DIAGNOSIS.ToString() + ";";
            myCom.CommandText = strSQL;
            myCom.Connection = refParent;
            myReader = myCom.ExecuteReader();
            YPoint = 453;nDiagType=0;
            lstComboName.Items.Clear();
            txtExtraDiagnosis = new TextBox();
            cboExtraNote = new ComboBox();

            txtExtraTreatment = new TextBox();
            if (myReader.HasRows)
            {
                while (myReader.Read())
                {
                    cType  = myReader.GetInt32(0);
                    if (cType!=pType)
                    {//new combo
                        cboShow_Diag = new ComboBox();
                        cboShow_Diag.Cursor = Cursors.Hand;
                        cboShow_Diag.FlatStyle = FlatStyle.Popup;
                        cboShow_Diag.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                        cboShow_Diag.FormattingEnabled = true;
                        cboShow_Diag.Name = cType.ToString();
                        cboShow_Diag.Location = new System.Drawing.Point(180, YPoint);
                        lstComboName.Items.Add(COMBO_DIAGNOSIS_NAME + myReader.GetInt32(0).ToString());
                        cboShow_Diag.Name = COMBO_DIAGNOSIS_NAME + myReader.GetInt32(0).ToString();
                        cboShow_Diag.Size = new System.Drawing.Size(430, 28);

                        lblShow_Diag = new Label();
                        lblShow_Diag.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                        lblShow_Diag.Location = new System.Drawing.Point(99, YPoint);
                        lblShow_Diag.Name = "lbl"+COMBO_DIAGNOSIS_NAME + nDiagType.ToString();
                        lblShow_Diag.Size = new System.Drawing.Size(100, 23);
                        lblShow_Diag.Text = myReader.GetString(2);
                        pType = cType;
                        YPoint += 30;
                        nDiagType++;
                        this.Controls.Add(cboShow_Diag);
                        this.Controls.Add(lblShow_Diag);
                    }//new item
                    if (cboShow_Diag!=null)
                    {
                        //tblDetailsInfor.Details_ID, tblDetailsInfor.Details_Content
                        if (!myReader.IsDBNull(3))
                        {
                            cboShow_Diag.Items.Add(myReader.GetValue(3).ToString() + FRM_SEPPERATE_ID_NAME + myReader.GetValue(4).ToString());
                        }
                    }
                }//read one record
            }//has rows
            txtExtraDiagnosis.Location= new System.Drawing.Point(180, YPoint);
            txtExtraDiagnosis.Size = new System.Drawing.Size(430, 46);
            txtExtraDiagnosis.Multiline =true;
            //txtExtraDiagnosis.BorderStyle
            YPoint += 52;
            this.cboShow_Diagnosis = new ComboBox[nDiagType];
            for (i=0; i<nDiagType; i++)
            {
                this.cboShow_Diagnosis[i] = (ComboBox)this.Controls[lstComboName.Items[i].ToString()];
            }
            myReader.Close();
            strSQL = "SELECT tblMasterInfor.M_ID, tblMasterInfor.M_Type, tblMasterInfor.M_Name, tblDetailsInfor.Details_ID, tblDetailsInfor.Details_Content FROM tblMasterInfor LEFT JOIN tblDetailsInfor ON tblMasterInfor.M_ID = tblDetailsInfor.Mas_ID WHERE tblMasterInfor.M_Type=" + frmAddNewMasterItem.ENUM_INTEGER_CATOGERY_TREATMENT.ToString() + ";";
            myCom.CommandText = strSQL;
            myCom.Connection = refParent;
            myReader = myCom.ExecuteReader();
            lblLastTreatment.Location= new System.Drawing.Point(1, YPoint);

            cboShow_Treatment = new ComboBox();
            cboShow_Treatment.Cursor = Cursors.Hand;
            cboShow_Treatment.FlatStyle = FlatStyle.Popup;
            cboShow_Treatment.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            cboShow_Treatment.FormattingEnabled = true;
            cboShow_Treatment.Location = new System.Drawing.Point(180, YPoint);
            cboShow_Treatment.Name = "cboShow_Treatment";
            cboShow_Treatment.Size = new System.Drawing.Size(430, 28);
            nDiagType ++;
            this.Controls.Add(cboShow_Treatment);

            cboShow_Treatment.Items.Clear();

            if (myReader.HasRows)
            {
                while (myReader.Read())
                {
//.........这里部分代码省略.........
开发者ID:VinhNT,项目名称:MedicineCenter,代码行数:101,代码来源:frmPatientRecord.cs

示例14: LoadProfile

        public void LoadProfile(string ProfileID)
        {
            OleDbCommand myCom;
            OleDbDataReader myReader;
            string[] strOther;
            string strTmp, strOneItem;
            int i, intCombo, n, noOfComboBox, noOfImages, x;
            bool isContinue;
            myCom = refConn.CreateCommand();
            myCom.CommandText ="SELECT Pro_PatientID, Pro_Date, Pro_Image1, Pro_Image2, Pro_Image3, Pro_Image4, Pro_Image5, Pro_Image6, Pro_Comment1, Pro_Comment2, Pro_Comment3, Pro_Comment4, Pro_Comment5, Pro_Comment6, Pro_Other, Pro_ExtraDiagnosis, Pro_ExtraTreatment, Pro_DoctorNote FROM tblProfile WHERE PROFILE_ID=" + ProfileID + ";";
            myReader = myCom.ExecuteReader();
            if (myReader.HasRows)
            {
                myReader.Read();
                LoadPatient(myReader.GetInt32(0).ToString());
                noOfImages = 0;
                for (i=2; i<8; i++)
                {
                    if (!myReader.IsDBNull(i))
                    {
                        noOfImages ++;
                        LoadImage(myReader.GetString(i), i-1);
                    }
                }
                nudNoOfPicture.Value = noOfImages;
                NudNoOfPictureValueChanged(null, null);
                for (i=8;i<14 ;i++ ) if (!myReader.IsDBNull(i)) ((TextBox)this.Controls["txtNote_" + (i-5).ToString()]).Text = myReader.GetString(i);
                noOfComboBox = cboShow_Diagnosis.Length;
                if (!myReader.IsDBNull(14))
                {
                    string [] strXXX;
                    strXXX = new string[]{OTHER_DIAGNOSIS_SEPERATE};
                    strTmp = myReader.GetValue(14).ToString();
                    strOther = strTmp.Split(strXXX, StringSplitOptions.RemoveEmptyEntries);
                    n = strOther.Length;
                    for (i=0; i<n; i++)
                    {

                        for (intCombo =0; intCombo<noOfComboBox; intCombo++)
                        {
                            strTmp = cboShow_Diagnosis[intCombo].Name.Substring(COMBO_DIAGNOSIS_NAME.Length);
                            if (strOther[i].StartsWith(strTmp))
                            {
                                x = strOther[i].IndexOf(FRM_SEPPERATE_ID_NAME) + FRM_SEPPERATE_ID_NAME.Length;
                                cboShow_Diagnosis[intCombo].Text = strOther[i].Substring(x);
                            }

                        }//Visit all diag
                        strTmp = cboShow_Treatment.Name.Substring(COMBO_DIAGNOSIS_NAME.Length);
                        if (strOther[i].StartsWith(strTmp))
                        {
                            x = strOther[i].IndexOf(FRM_SEPPERATE_ID_NAME) + FRM_SEPPERATE_ID_NAME.Length;
                            cboShow_Treatment.Text = strOther[i].Substring(x);
                        }
                    //Get treatment
                    }
                }//Composite field
                //Extra diagnosis
                if (!myReader.IsDBNull(15))
                    txtExtraDiagnosis.Text = myReader.GetString(15);
                else
                    txtExtraDiagnosis.Text= "";
                if (!myReader.IsDBNull(16))
                    txtExtraTreatment.Text = myReader.GetString(16);
                else
                    txtExtraTreatment.Text= "";
                if (!myReader.IsDBNull(17))
                    cboExtraNote.Text = myReader.GetString(17);
                else
                    cboExtraNote.Text= "";
            }else
            {
                return;
            }
            myReader.Close();
            myCom.CommandText = "SELECT Profile_Related FROM tblProfileDetails WHERE Profile_ID =" + ProfileID + ";";
            myReader = myCom.ExecuteReader();
            noOfComboBox = cboShow_Diagnosis.Length;
            if (myReader.HasRows)
            {
                while (myReader.Read())
                {
                    strTmp = myReader.GetInt32(0).ToString() + FRM_SEPPERATE_ID_NAME;
                    isContinue = true;
                    for (intCombo =0; intCombo<noOfComboBox; intCombo++)
                    {
                        n = cboShow_Diagnosis[intCombo].Items.Count;
                        for (i=0; i<n; i++)
                        {
                            strOneItem = cboShow_Diagnosis[intCombo].Items[i].ToString();
                            if (strOneItem.StartsWith(strTmp))
                            {
                                cboShow_Diagnosis[intCombo].SelectedIndex = i;
                                intCombo = noOfComboBox;
                                isContinue =false;
                                i=n;
                            }
                        }
                    }//Visit all diag
                    //Get treatment
//.........这里部分代码省略.........
开发者ID:VinhNT,项目名称:MedicineCenter,代码行数:101,代码来源:frmPatientRecord.cs

示例15: LoadPatient

 public void LoadPatient(string patientID)
 {
     string strSQL;OleDbCommand myCom;
     OleDbDataReader myReader;
     int i, n, c;
     this.isEditPatient =true;
     strSQL = "SELECT Patient_Name, Patient_Address, Patient_Age, Patient_Gender, Patient_Tel, Patient_Career FROM tblPatient WHERE Patient_ID=" + patientID + ";";
     myCom = refConn.CreateCommand();
     myCom.CommandText = strSQL;
     myReader = myCom.ExecuteReader();
     if (myReader.HasRows)
     {
         myReader.Read();
         strPatientID = patientID;
         txtPatientName.Text = myReader.GetString(0);
         txtPatientAddress.Text = myReader.IsDBNull(1)?"":myReader.GetString(1);
         txtPatientAge.Text = myReader.GetByte(2).ToString();
         cboPatientGender.SelectedIndex = myReader.GetByte(3);
         txtPatientPhone.Text = myReader.IsDBNull(4)?"":myReader.GetString(4);
         if (!myReader.IsDBNull(5))
         {
             n = lstCareerID.Items.Count-1;
             c = myReader.GetInt32(5);
             for(i=0; i<n; i++)
             {
                 if (int.Parse(lstCareerID.Items[i].ToString())==c)
                 {
                     cboPatientCareer.SelectedIndex =i;
                     break;
                 }
             }
         }else cboPatientCareer.SelectedIndex =-1;
         strPatientID = patientID;
     }
 }
开发者ID:VinhNT,项目名称:MedicineCenter,代码行数:35,代码来源:frmPatientRecord.cs


注:本文中的System.Data.OleDb.OleDbDataReader.IsDBNull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。