• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Odbc.OdbcDataReader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Data.Odbc.OdbcDataReader的典型用法代码示例。如果您正苦于以下问题:C# OdbcDataReader类的具体用法?C# OdbcDataReader怎么用?C# OdbcDataReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



OdbcDataReader类属于System.Data.Odbc命名空间,在下文中一共展示了OdbcDataReader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: DisplayRecords

        /// <summary>
        /// DisplayRecords: This function displays the records in the view if any.
        /// </summary>
        static void DisplayRecords()
        {
            Console.Write("\tRecords in Prescirption list...");

            try
            {
                reader = (OdbcDataReader)command.ExecuteReader();
                // read the returned resultset
                while (reader.Read())
                {
                    /*
                     * This view consists the following fields:
                     * rxdef_id (TINYINT)
                     * drug_name (CHARACTER 50)
                     * description (CHARACTER 50)
                     * rx_date (DATE)
                     * For the purpose of keeping it simple, we are displaying the rxdef_id and drug_name on the console (the first two fields)
                     */
                    Console.WriteLine("\n\t\t{0}  {1}  ", reader.GetInt16(0), reader.GetString(1));
                }
                // close the reader
                reader.Close();
            }
            catch (Exception e)
            {
                ExceptionDisplay(e);
            }
        }
开发者ID:cgabilla,项目名称:cKarp,代码行数:31,代码来源:M6DtxConnector.cs


示例2: CreateForm

        public static bool CreateForm(OdbcDataReader reader, AppUser user)
        {
            int fCount = reader.FieldCount;
            for (int i = 0; i < fCount; i++)
            {
                string name = reader.GetName(i);
                // Map to DB field. Need to change if db changed
                switch (name)
                {
                    case "username": user._username = reader.GetString(i);
                        break;
                    case "user_id": user._userId = reader.GetInt32(i);
                        break;
                    case "passwd": user._encodedPassword = reader.GetString(i);
                        break;
                    case "firstname": user._firstname = reader.GetString(i);
                        break;
                    case "surname": user._surname = reader.GetString(i);
                        break;
                    case "role_id": user._roleId = reader.GetInt32(i);
                        break;
                    case "branch_id": user._branchID = reader.GetInt32(i);
                        break;
                    case "is_valid": user._isValid = reader.GetInt32(i) > 0 ? true : false;
                        break;

                    // helper info
                    case "branch_name": user._branchName = reader.GetString(i);
                        break;

                }
            }
            return reader.HasRows;
        }
开发者ID:nettatata,项目名称:btsman,代码行数:34,代码来源:AppUser.cs


示例3: CreateForm

        public static bool CreateForm(OdbcDataReader reader, Branch branch)
        {
            int fCount = reader.FieldCount;
            for (int i = 0; i < fCount; i++)
            {
                string name = reader.GetName(i);

                // Map to DB field. Need to change if db changed
                switch (name) {
                    case "branch_id": branch._branchID = reader.GetInt32(i);
                                      break;
                    case "branch_name": branch._branchName = reader.GetString(i);
                                      break;
                    case "branch_code": branch._branchCode = reader.GetString(i);
                                      break;
                    case "address": branch._address = reader.GetString(i);
                                      break;
                    case "tel": branch._tel = reader.GetString(i);
                                      break;
                    case "img": branch._img = reader.GetString(i);
                                      break;
                    case "supervisor": branch._supervisor = reader.GetString(i);
                                      break;
                }
            }
            return reader.HasRows;
        }
开发者ID:nettatata,项目名称:btsman,代码行数:27,代码来源:Branch.cs


示例4: CreateForm

        public static bool CreateForm(OdbcDataReader reader, Room room)
        {
            int fCount = reader.FieldCount;
            for (int i = 0; i < fCount; i++)
            {
                string name = reader.GetName(i);

                // Map to DB field. Need to change if db changed
                switch (name) {
                    case "room_id": room._roomID = reader.GetInt32(i);
                                      break;
                    case "branch_id": room._branchID = reader.GetInt32(i);
                                      break;
                    case "name": room._name = reader.GetString(i);
                                      break;
                    case "seat_no": room._seatNo = reader.GetInt32(i);
                                      break;
                    case "img": room._img = reader.GetString(i);
                                      break;
                    case "description": room._description = reader.GetString(i);
                                      break;

                    // helper info
                    case "branch_name": room._branchName = reader.GetString(i);
                                      break;

                }
            }
            return reader.HasRows;
        }
开发者ID:nettatata,项目名称:btsman,代码行数:30,代码来源:Room.cs


示例5: DbCache

 //Constructor
 internal DbCache(OdbcDataReader record, int count) {
     _count = count;
     _record = record;
     _randomaccess = (!record.IsBehavior(CommandBehavior.SequentialAccess));
     _values = new object[count];
     _isBadValue = new bool[count];
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:8,代码来源:DbDataRecord.cs


示例6: DisplayRecords

        /// <summary>
        /// DisplayRecords: This function displays the records in the view if any.
        /// </summary>
        static void DisplayRecords()
        {
            Console.Write("\tRecord in getpatientbalance stored procedure");

            try
            {
                reader = (OdbcDataReader)command.ExecuteReader();
                // read the returned resultset
                while (reader.Read())
                {
                    /*
                     * This view consists the following fields:
                     * pat_id
                     * pat_0_30_days
                     * pat_31_60_days
                     * pat_61_90_days
                     * pat_91_120_days
                     * pat_121_plus_days
                     * last_pmt_date
                     * last_pmt_amt
                     * last_pmt_type
                     * last_pmt_desc
                     */
                    Console.WriteLine("\npat_id:{0}\npat_0_30_days: {1}\npat_31_60_days: {2} \npat_61_90_days: {3}\npat_91_120_plus_days: {4} \npat_121_plus_days: {5}\nlast_pmt_date: {6} \nlast_pmt_amt: {7}\nlast_pmt_type: {8}\nlast_pmt_desc: {9}",
                        reader.GetValue(0), reader.GetValue(1), reader.GetValue(2), reader.GetValue(3), reader.GetValue(4), reader.GetValue(5), reader.GetValue(6), reader.GetValue(7), reader.GetValue(8), reader.GetValue(9));
                }
                // close the reader
                reader.Close();
            }
            catch (Exception e)
            {
                ExceptionDisplay(e);
            }
        }
开发者ID:cgabilla,项目名称:cKarp,代码行数:37,代码来源:StoredProcedureTutorial.cs


示例7: formatTasks

 public XDocument formatTasks(OdbcDataReader r)
 {
     xdoc = new XDocument();
     XElement title, notes, startdatetime, enddatetime, place, id;
     XElement root = new XElement("message");
     XAttribute type = new XAttribute("type", "tasks");
     XAttribute errorStatus = new XAttribute("error_status", "0");
     root.Add(type);
     XElement tasks = new XElement("tasks");
     while (r.Read())
     {
         XElement task = new XElement("task");
         id = new XElement("id", r.GetValue(0).ToString());
         task.Add(id);
         title = new XElement("title", r.GetValue(1).ToString());
         task.Add(title);
         notes = new XElement("notes", r.GetValue(2).ToString());
         task.Add(notes);
         startdatetime = new XElement("startdatetime", r.GetValue(3).ToString());
         task.Add(startdatetime);
         enddatetime = new XElement("enddatetime", r.GetValue(4).ToString());
         task.Add(enddatetime);
         place = new XElement("place", r.GetValue(5).ToString());
         task.Add(place);
         tasks.Add(task);
     }
     root.Add(tasks);
     root.Add(errorStatus);
     xdoc.Add(root);
     return xdoc;
 }
开发者ID:Palethorn,项目名称:Scheduler,代码行数:31,代码来源:MessageFormatter.cs


示例8: GetReader

        // Create an instance dataReader
        // Return type object of OdbcDataReader
        public void GetReader(string strQuery)
        {
            //  Create a Command object
            aCommand = new OdbcCommand(strQuery, connection);
            // Create data reader object using strQuery string

            ReadData = aCommand.ExecuteReader(CommandBehavior.CloseConnection);
        }
开发者ID:kawaikiwii,项目名称:test,代码行数:10,代码来源:DbConn.cs


示例9: InsertData

public static void InsertData(OdbcDataReader read)
{
string table = @"d:\documents and settings\axkhan2\desktop\437proj\mytariff.dbf";
string query = "insert into " + table + "values (@ln, @orgcity, @destcity, @orgzone, @destzone, @ocountry, @dcountry, @orgcountry, @destcountry)"; //, @origin, @dest, @min, @rate, @rate, @basert, @frmwt, @towt, @cur, @validfrm, @validtill, @filename	
OleDbConnection con = new OleDbConnection(@"Provider=VFPOLEDB.1;Data Source=d:\documents and settings\axkhan2\desktop\437proj\");
try
{
OleDbCommand cmd = new OleDbCommand(query, con);
con.Open();
while(read.Read())
{
cmd.Parameters.Add(new OleDbParameter("@ln", Convert.ToInt32(read[0].ToString())));
cmd.Parameters.Add(new OleDbParameter("@orgcity", read[2].ToString()));
cmd.Parameters.Add(new OleDbParameter("@destcity", read[5].ToString()));
cmd.Parameters.Add(new OleDbParameter("@orgzone", read[4].ToString()));
cmd.Parameters.Add(new OleDbParameter("@destzone", read[7].ToString()));
cmd.Parameters.Add(new OleDbParameter("@ocountry", read[2].ToString()));
cmd.Parameters.Add(new OleDbParameter("@dcountry", read[6].ToString()));
cmd.Parameters.Add(new OleDbParameter("@orgcountry", "NL"));
cmd.Parameters.Add(new OleDbParameter("@destcountry", "FI"));

/*cmd.Parameters.Add(new OleDbParameter("origin", String.Empty));
cmd.Parameters.Add(new OleDbParameter("dest", String.Empty));
cmd.Parameters.Add(new OleDbParameter("min", double.Parse(read[10].ToString())));
cmd.Parameters.Add(new OleDbParameter("basert", null));
cmd.Parameters.Add(new OleDbParameter("rate", null));
cmd.Parameters.Add(new OleDbParameter("frmwt", null));
cmd.Parameters.Add(new OleDbParameter("towt", null));
cmd.Parameters.Add(new OleDbParameter("cur", null));
cmd.Parameters.Add(new OleDbParameter("validfrm", null));
cmd.Parameters.Add(new OleDbParameter("validtill", null));
*/
/*cmd.Parameters.Add(new OleDbParameter("rate", double.Parse(read["rate"].ToString())));
cmd.Parameters.Add(new OleDbParameter("frmwt", double.Parse(read["from_wt"].ToString())));
cmd.Parameters.Add(new OleDbParameter("towt", double.Parse(read["to_wt"].ToString())));
cmd.Parameters.Add(new OleDbParameter("cur", read["currency"].ToString()));
cmd.Parameters.Add(new OleDbParameter("validfrm", DateTime.Parse(read["valid_from"].ToString())));
cmd.Parameters.Add(new OleDbParameter("validtill", DateTime.Parse(read["valid_till"].ToString())));
*/
cmd.Parameters.Add(new OleDbParameter("validtill", "mytariff.xls"));

cmd.ExecuteNonQuery();
}
}
catch(OleDbException ex)
{
Console.WriteLine(ex.Message);
}
finally 
{
con.Close();
}

}
开发者ID:EdiCarlos,项目名称:MyPractices,代码行数:54,代码来源:example1.cs


示例10: PrintResults

 private static void PrintResults(OdbcDataReader reader) {
   for (int ii = 0; ii < reader.FieldCount; ii += 1) {
     System.Console.Write("{0}{1}",
         reader.GetName(ii),
         ii + 1 < reader.FieldCount ? "\t" : "\n");
   }
   while (reader.Read()) {
     for (int ii = 0; ii < reader.FieldCount; ii += 1) {
       System.Console.Write("{0}{1}",
           reader.GetValue(ii),
           ii + 1 < reader.FieldCount ? "\t" : "\n");
     }
   }
 }
开发者ID:t4ku,项目名称:bigquery-e2e,代码行数:14,代码来源:bigquery_odbc.cs


示例11: convertOdbcDataToList

        public static List<List<string>> convertOdbcDataToList(OdbcDataReader reader)
        {
            List<List<string>> lr = new List<List<string>>();
            while(reader.Read())
            {
                List<string> lsItem = new List<string>();

                for (int i = 0; i < reader.FieldCount; i++)
                {
                    lsItem.Add(reader[i].ToString());
                }
                lr.Add(lsItem);
            }
            return lr;
        }
开发者ID:budlion,项目名称:DSTPRJ,代码行数:15,代码来源:StringUtil.cs


示例12: CreateForm

        public static bool CreateForm(OdbcDataReader reader, Role role)
        {
            int fCount = reader.FieldCount;
            for (int i = 0; i < fCount; i++)
            {
                string name = reader.GetName(i);

                // Map to DB field. Need to change if db changed
                switch (name) {
                    case "name": role._name = reader.GetString(i);
                                      break;
                    case "role_id": role._roleId = reader.GetInt32(i);
                                      break;
                }
            }
            return reader.HasRows;
        }
开发者ID:nettatata,项目名称:btsman,代码行数:17,代码来源:Role.cs


示例13: read

        public QuestionEntity read(OdbcDataReader reader)
        {
            var res = new QuestionEntity();
            res.id = reader.GetInt32(0);
            res.ans = reader.GetString(2);


            var choicejson = reader.GetString(3);
            var decoder = new JavaScriptSerializer();
            res.choices = decoder.Deserialize< ArrayList >(choicejson);

            res.imageURL = reader.GetString(4);
            res.statement = reader.GetString(5);
            res.type = getTypeString( reader.GetInt32(1) );

            return res;

        }
开发者ID:funtion,项目名称:exam-aspx,代码行数:18,代码来源:QuestionModel.cs


示例14: CreateForm

        public static bool CreateForm(OdbcDataReader reader, Payment payment)
        {
            int fCount = reader.FieldCount;
            for (int i = 0; i < fCount; i++)
            {
                string name = reader.GetName(i);

                // Map to DB field. Need to change if db changed
                switch (name) {
                    case "course_id": payment._courseID = reader.GetInt32(i);
                                      break;
                    case "sum_all_cost": payment._sumAllCost = reader.GetInt32(i);
                                      break;
                    case "sum_max_payable": payment._sumMaxPayable = reader.GetInt32(i);
                                      break;
                    case "sum_paid_cost": payment._sumPaidCost = reader.GetInt32(i);
                                      break;
                    case "last_paid_date": payment._lastPaidDate = new DateTime(reader.GetDate(i).Ticks);
                                      break;
                    case "paid_round": payment._paidRound = reader.GetInt32(i);
                                      break;
                    case "status": payment._status = reader.GetInt32(i);
                                      break;
                    // helper info
                    case "bts_course_id": payment._btsCourseID = reader.GetString(i);
                                      break;
                    case "course_name": payment._courseName = reader.GetString(i);
                                      break;
                    case "course_start_date": payment._courseStartDate = new DateTime(reader.GetDate(i).Ticks);
                                      break;
                    case "course_end_date": payment._courseEndDate = new DateTime(reader.GetDate(i).Ticks);
                                      break;
                    case "paid_group_id": payment._paidGroupID = reader.GetInt32(i);
                                      break;

                }
            }
            return reader.HasRows;
        }
开发者ID:nettatata,项目名称:btsman,代码行数:39,代码来源:Payment.cs


示例15: CreateForm

        public static bool CreateForm(OdbcDataReader reader, Teacher teacher)
        {
            int fCount = reader.FieldCount;
            for (int i = 0; i < fCount; i++)
            {
                string name = reader.GetName(i);

                // Map to DB field. Need to change if db changed
                switch (name) {
                    case "teacher_id": teacher._teacherID = reader.GetInt32(i);
                                      break;
                    case "sex": teacher._sex = reader.GetString(i);
                                      break;
                    case "addr": teacher._addr = reader.GetString(i);
                                      break;
                    case "tel": teacher._tel = reader.GetString(i);
                                      break;
                    case "email": teacher._email = reader.GetString(i);
                                      break;
                    case "birthday":
                        teacher._birthday = new DateTime(reader.GetDate(i).Ticks);
                                      break;
                    case "firstname": teacher._firstname = reader.GetString(i);
                                      break;
                    case "surname": teacher._surname = reader.GetString(i);
                                      break;
                    case "citizen_id": teacher._citizenID = reader.GetString(i);
                                      break;
                    case "image": teacher._img = reader.GetString(i);
                                      break;
                    case "subject": teacher._subject = reader.GetString(i);
                                      break;
                    case "is_active": teacher._isActive = reader.GetInt32(i) > 0 ? true : false;
                                      break;

                }
            }
            return reader.HasRows;
        }
开发者ID:nettatata,项目名称:btsman,代码行数:39,代码来源:Teacher.cs


示例16: executeQuery

 public OdbcDataReader executeQuery(string query, bool altering)
 {
     reader = null;
     rowsNo = 0;
     lock(conn)
     {
         command = conn.CreateCommand();
         if (altering)
         {
             command.CommandText = "START TRANSACTION";
             command.ExecuteNonQuery();
         }
         command.CommandText = query;
         rowsNo = command.ExecuteNonQuery();
         if (altering)
         {
             command.CommandText = "COMMIT";
             command.ExecuteNonQuery();
         }
         reader = command.ExecuteReader();
     }
         return reader;
 }
开发者ID:Palethorn,项目名称:Scheduler,代码行数:23,代码来源:DbAdapter.cs


示例17: CreateForm

        public static bool CreateForm(OdbcDataReader reader, PaidGroup paidGroup)
        {
            int fCount = reader.FieldCount;
            for (int i = 0; i < fCount; i++)
            {
                string name = reader.GetName(i);
                // Map to DB field. Need to change if db changed
                switch (name) {
                    case "paid_group_id": paidGroup._paidGroupID = reader.GetInt32(i);
                                      break;
                    case "name": paidGroup._name = reader.GetString(i);
                                      break;
                    case "current_round": paidGroup._currentRound = reader.GetInt32(i);
                                      break;
                    case "rate_info": paidGroup._rawRateInfo = reader.GetString(i);
                                      paidGroup._rateInfo = PaidRateInfo.Parse(paidGroup._rawRateInfo);
                                      break;

                    // helper info

                }
            }
            return reader.HasRows;
        }
开发者ID:nettatata,项目名称:btsman,代码行数:24,代码来源:PaidGroup.cs


示例18: readReward

 /// <summary>
 /// Constructs a reward from the output of a datareader. Assumes that there
 /// is data ready to be read from the current record 15/12/15
 /// </summary>
 private static Reward readReward(OdbcDataReader dataReader)
 {
     return new Reward(dataReader.GetInt16(0), dataReader.GetString(1),
     dataReader.GetString(2), dataReader.GetString(3), dataReader.GetInt16(4));
 }
开发者ID:LordJameh,项目名称:Computing-Project,代码行数:9,代码来源:Database.cs


示例19: readRank

 /// <summary>
 /// Constructs a rank from the output of a datareader. Assumes that there
 /// is data ready to be read from the current record 15/12/15
 /// </summary>
 private static Rank readRank(OdbcDataReader dataReader)
 {
     return new Rank(dataReader.GetInt16(0), dataReader.GetString(1),
     dataReader.GetInt16(2), dataReader.GetString(3));
 }
开发者ID:LordJameh,项目名称:Computing-Project,代码行数:9,代码来源:Database.cs


示例20: readAchievement

 /// <summary>
 /// Constructs an achievement from the output of a datareader. Assumes that there
 /// is data ready to be read from the current record 14/12/15
 /// </summary>
 private static Achievement readAchievement(OdbcDataReader dataReader)
 {
     return new Achievement(dataReader.GetInt16(0), dataReader.GetString(1),
     dataReader.GetString(2), dataReader.GetString(3), dataReader.GetString(4),
     dataReader.GetInt16(5), dataReader.GetDateTime(6), dataReader.GetBoolean(7));
 }
开发者ID:LordJameh,项目名称:Computing-Project,代码行数:10,代码来源:Database.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Odbc.OdbcParameter类代码示例发布时间:2022-05-26
下一篇:
C# Odbc.OdbcDataAdapter类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap