本文整理汇总了C#中System.Data.OleDb.OleDbDataReader.GetByte方法的典型用法代码示例。如果您正苦于以下问题:C# OleDbDataReader.GetByte方法的具体用法?C# OleDbDataReader.GetByte怎么用?C# OleDbDataReader.GetByte使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.OleDb.OleDbDataReader
的用法示例。
在下文中一共展示了OleDbDataReader.GetByte方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: frmMainForm
//Image mainBackGroundImage;
public frmMainForm()
{
byte i =0;
PrivateDataEncode pde = new PrivateDataEncode();
myConn = new OleDbConnection();
myCom = new OleDbCommand();
myCom.CommandText="Select M_ID, M_Name, M_Type, M_Description From tblMasterInfor ORDER BY M_Type";
myCom.Connection = myConn;
myConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Data.mdb;Jet OLEDB:Database Password=whatthehellisgoingon";
try{
myConn.Open();
}catch(Exception e)
{
MessageBox.Show(ERROR_WHILE_LOADING_DATABASE + e.Message.ToString(), "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
this.Dispose();
Application.Exit();
}
myReader = myCom.ExecuteReader();
System.ComponentModel.ComponentResourceManager resources1 = new System.ComponentModel.ComponentResourceManager(typeof(frmMainForm));
InitializeComponent();
if (myReader.HasRows)
{
while (myReader.Read())
{
this.tbTmp4LoadDynamic = new System.Windows.Forms.ToolStripButton();
this.tbTmp4LoadDynamic.Overflow = ToolStripItemOverflow.Never;
if (myReader.GetByte(2) ==frmAddNewMasterItem.ENUM_INTEGER_CATOGERY_DIAGNOSIS)
{
try{
this.tbTmp4LoadDynamic.Image = Image.FromFile(Application.StartupPath + @"\image\diagnosis.bmp");
}catch(System.IO.FileNotFoundException){}
}else if (myReader.GetByte(2) ==frmAddNewMasterItem.ENUM_INTEGER_CATOGERY_TREATMENT)
{//treatment
try{
this.tbTmp4LoadDynamic.Image = Image.FromFile(Application.StartupPath + @"\image\treatment.bmp");//career.bmp
}catch(System.IO.FileNotFoundException){}
}else
{
try{
this.tbTmp4LoadDynamic.Image = Image.FromFile(Application.StartupPath + @"\image\career.bmp");
}catch(System.IO.FileNotFoundException){}
}
//this.tbTmp4LoadDynamic.Image = ((System.Drawing.Image)(resources.GetObject("mnuBtnPatientRecord.Image")));
this.tbTmp4LoadDynamic.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.tbTmp4LoadDynamic.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
this.tbTmp4LoadDynamic.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tbTmp4LoadDynamic.Name = "tb" +myReader.GetValue(0).ToString();
this.tbTmp4LoadDynamic.Size = new System.Drawing.Size(90, 40);
this.tbTmp4LoadDynamic.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.tbTmp4LoadDynamic.Click += new System.EventHandler(this.DynamicToolBarClick);
this.tbTmp4LoadDynamic.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tbTmp4LoadDynamic.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.ImageAndText;
this.tbTmp4LoadDynamic.Text = myReader.GetString(1);
this.tbTmp4LoadDynamic.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
this.tbTmp4LoadDynamic.DoubleClick += new EventHandler(DynamicToolBarClick);
sepTmp = new ToolStripSeparator();
sepTmp.Name = "auto" + i++.ToString();
sepTmp.Size = new System.Drawing.Size(6, 1);
this.tbMainToolBar.Items.AddRange(new System.Windows.Forms.ToolStripItem[]{sepTmp, tbTmp4LoadDynamic});
}// myReader.Read()
}//myReader.HasRows
myReader.Close();
this.frmMainForm_SizeChanged(null, null);
}
示例2: 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;
}
}