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


C# SqlDataReader.GetValue方法代码示例

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


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

示例1: Button1_Click1

    protected void Button1_Click1(object sender, EventArgs e)
    {
        Panel3.Visible = true;

        Label26.Text = Session["dn"].ToString();
        cmd = new SqlCommand("select orderno,orderdate,deliverydate,name from booking where name='" + Session["nm"].ToString() + "' and Delivery='" + Labeldeliveryresult.Text + "' and distributorname='" + Session["dn"].ToString() + "'", con);
        con.Open();
        dr = cmd.ExecuteReader();
        string s1 = "";
        while (dr.Read())
        {
            s1 = dr.GetValue(0).ToString();

            TextBox18.Text = dr.GetValue(1).ToString();
            TextBox14.Text = dr.GetValue(2).ToString();
            TextBox16.Text = dr.GetValue(3).ToString();
        }
        TextBox12.Text = s1;
        TextBox13.Text = (int.Parse(s1) + 1000).ToString();
        dr.Close();
        cmd = new SqlCommand("select email,city from consumer where username='" + Session["un"].ToString() + "'", con);
        dr = cmd.ExecuteReader();
        if (dr.Read())
        {
            TextBox17.Text = dr.GetValue(0).ToString();
            TextBox19.Text = dr.GetValue(1).ToString();

        }
    }
开发者ID:ronojitbanerjee1992,项目名称:e-gas-booking,代码行数:29,代码来源:generatebill.aspx.cs

示例2: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        String q = Request.Params[0];
        ora.Open();
        cmd = new SqlCommand("select * from personalinfo where name like '%" + q + "%' or emailid like '%" + q + "%' or ccity like '%" + q + "%'" , ora);
        try
        {
            dr = cmd.ExecuteReader();
            while (dr.Read())
            {
                string path,url,uid;

                string media = dr.GetValue(13).ToString();
                string username = dr.GetValue(2).ToString();
                string email = dr.GetValue(6).ToString();
                string country = dr.GetValue(16).ToString();
                uid=dr.GetValue(1).ToString();
                path = media.Substring(2);

                url = "searchprofile.aspx?userid="+uid;
                 Response.Write("<a href = '" + url +"'><div class='display_box' align='left'><img src='" + path + "' style='width:50px; height:50px; float:left; margin-right:6px;' /><span class='name'>" + username + "</span>&nbsp;<br/>" + email + "<br/><span style='font-size:9px; color:#999999'>" + country + "</span></div></a>");
               // Response.Write("<a href = '" + url +"'></a>");
            }

        }
        catch (Exception ex)
        {

        }
        ora.Close();
    }
开发者ID:anuj1992,项目名称:Alumni,代码行数:31,代码来源:Search.aspx.cs

示例3: fillData

 public override void fillData(SqlDataReader reader)
 {
     drivinglicence = (string)reader.GetValue(0);
     drivinglicencetype = (string)reader.GetValue(1);
     point = (int)reader.GetValue(2);
     ID = (string)reader.GetValue(3);
 }
开发者ID:gtx1049,项目名称:DataBaseCurseDesign,代码行数:7,代码来源:Carmanager.cs

示例4: lbtnforgetpass_Click

        protected void lbtnforgetpass_Click(object sender, EventArgs e)
        {

            if (txtforgrtid.Text == "")
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "popup",
                        "alert('Please Enter The User_ID.');", true);
                return;
            }
            else
            {
                a = txtforgrtid.Text;
            }
            try
            {
                dr = cls.FillDataReader("select R_password , R_EmailId from Registerlist where R_logid='" + a + "'");
                if (dr.Read())
                {
                    if (!dr.IsDBNull(0))
                    {
                        pass = dr.GetValue(0).ToString();
                    }
                    if (!dr.IsDBNull(1))
                    {
                        emal = dr.GetValue(1).ToString();
                    }
                }
                dr.Close();
                if (pass == null && emal == null)
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "popup",
                        "alert('Not a valid User_ID.');", true);
                    txtforgrtid.Text = "";
                    return;
                }
                else
                {
                    bool var = MailHelper.CheckForInternetConnection();
                    if (var == true)
                    {
                        MailHelper.SendMailMessage("[email protected]", emal, "Password", "Your Password:'" + pass + "'");
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "popup",
                                 "alert('Password have been sent to your registered email_ID.');", true);
                        txtforgrtid.Text = "";
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "popup",
                            "alert('Please Check Your Internet Connection.');", true);
                        txtforgrtid.Text = "";
                    }
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "popup",
                   "alert(" + ex + ");", true);
            }
        }
开发者ID:neerajbattish,项目名称:files1,代码行数:59,代码来源:loginpage.aspx.cs

示例5: fillData

 //you must override this function so that you can fill the object
 public override void fillData(SqlDataReader reader)
 {
     if (reader.Read())
     {
         ID = (string)reader.GetValue(0);
         name = (string)reader.GetValue(1);
         gender = (string)reader.GetValue(2);
         hometown = (string)reader.GetValue(3);
         address = (string)reader.GetValue(4);
         telephone = (string)reader.GetValue(5);
         birthday = (DateTime)reader.GetValue(6);
         crimestatus = (string)reader.GetValue(7);
         if (reader[8].GetType() != typeof(DBNull))
         {
             byte[] bs = (byte[])reader[8];
             MemoryStream memoryStream = new MemoryStream(bs);
             photo = new Bitmap(memoryStream);
         }
         else
         {
             photo = null;
         }
         tax = (int)reader.GetValue(9);
     }
 }
开发者ID:gtx1049,项目名称:DataBaseCurseDesign,代码行数:26,代码来源:Citizen.cs

示例6: ToSchema

 private new List<BaseTable> ToSchema(SqlDataReader reader)
 {
     List<BaseTable> result = new List<BaseTable>();
     while (reader.Read())
     {
         var table = new CarcassColorTable
         {
             Carcasscolorid = new Guid(reader.GetValue(0).ToString()),
             Carcasscolorcolor = reader.GetValue(1).ToString()
         };
         table.UpdateFieldList.Clear();
         result.Add(table);
     }
     return result;
 }
开发者ID:maximzyl,项目名称:DB,代码行数:15,代码来源:CarcassColorTable.cs

示例7: Populate

 internal override void Populate(SqlDataReader sqlDataReader)
 {
     for (int i = 0; i < sqlDataReader.FieldCount; i++)
     {
         switch (sqlDataReader.GetName(i))
         {
             case "ID":
                 ID = int.Parse(sqlDataReader.GetValue(i).ToString());
                 break;
             case "Category":
                 Category = sqlDataReader.GetValue(i).ToString();
                 break;
         }
     }
 }
开发者ID:brahammar,项目名称:dev15,代码行数:15,代码来源:Categories.cs

示例8: CreateDocument

        static Document CreateDocument(SqlDataReader reader, IDictionary<int, List<string>> packageFrameworks)
        {
            var package = new Dictionary<string, string>();
            for (var i = 0; i < reader.FieldCount; i++)
            {
                if (!reader.IsDBNull(i))
                {
                    string name = reader.GetName(i);
                    object obj = reader.GetValue(i);

                    if (name == "key")
                    {
                        var key = (int)obj;
                        List<string> targetFrameworks;
                        if (packageFrameworks.TryGetValue(key, out targetFrameworks))
                        {
                            package.Add("supportedFrameworks", string.Join("|", targetFrameworks));
                        }
                    }

                    var value = (obj is DateTime) ? ((DateTime)obj).ToUniversalTime().ToString("O") : obj.ToString();

                    package.Add(name, value);
                }
            }

            return DocumentCreator.CreateDocument(package);
        }
开发者ID:NuGet,项目名称:NuGet.Services.Metadata,代码行数:28,代码来源:Sql2Lucene.cs

示例9: Factory

        public static NewMemberBalancePrediction Factory(SqlDataReader reader)
        {
            var newMemberId = reader.GetInt32(0);
            var dependentId = reader.GetInt32(1);
            var birthYear = reader.GetInt32(2);
            var state = reader.GetString(3);
            var lastCptCode = reader.GetString(4);
            var cachedBalance = reader.GetString(5);
            var recommendedBalance = reader.GetValue(6);

            double d;
            double.TryParse(recommendedBalance == null ? "0" : recommendedBalance.ToString(), out d);
            var sufficientAmount = reader.GetInt32(7);
            var serviceEnd = reader.GetDateTime(8);

            return new NewMemberBalancePrediction
                       {
                           NewMemberId = newMemberId,
                                 DependentId = dependentId,
                                 BirthYear = birthYear,
                                 State = state,
                                 LastCptCode = lastCptCode,
                                 CachedBalance = cachedBalance,
                                 RecommendedBalance = Math.Round(d, 2),
                                 SufficientAmount = sufficientAmount,
                                 ServiceEnd = serviceEnd
                       };
        }
开发者ID:roylanceMichael,项目名称:Health_Equity_Claims_Machine_Learning,代码行数:28,代码来源:NewMemberBalancePrediction.cs

示例10: ValidateDataReader_T

 public static DateTime ValidateDataReader_T(SqlDataReader reader,string colname)
 {
     if(reader.GetValue(reader.GetOrdinal(colname))!=DBNull.Value)
         return reader.GetDateTime(reader.GetOrdinal(colname));
     else
         return System.DateTime.MinValue;
 }
开发者ID:JohnToCoder,项目名称:MyBookShop_1,代码行数:7,代码来源:GetSafeData.cs

示例11: ValidateDataReader_S

 /// <summary>
 /// ��SqlDataReader�а�ȫ��ȡ����
 /// </summary>
 /// <param name="reader">���ݶ�ȡ��SqlDataReader</param>
 /// <param name="colname">����</param>
 /// <returns>���е��ַ������ݣ����Ϊ�գ��򷵻�System.String.Empty</returns>
 public static string ValidateDataReader_S(SqlDataReader reader,string colname)
 {
     if(reader.GetValue(reader.GetOrdinal(colname))!=DBNull.Value)
         return reader.GetString(reader.GetOrdinal(colname));
     else
         return System.String.Empty;
 }
开发者ID:JohnToCoder,项目名称:MyBookShop_1,代码行数:13,代码来源:GetSafeData.cs

示例12: ValidateDataReader_N

 public static int ValidateDataReader_N(SqlDataReader reader,string colname)
 {
     if(reader.GetValue(reader.GetOrdinal(colname))!=DBNull.Value)
         return reader.GetInt32(reader.GetOrdinal(colname));
     else
         return System.Int32.MinValue;
 }
开发者ID:JohnToCoder,项目名称:MyBookShop_1,代码行数:7,代码来源:GetSafeData.cs

示例13: GetValue

        private Value GetValue(SqlDataReader reader, int column)
        {
            Value value = new Value();

            value.Item = reader.GetValue(column);

            Type type = value.Item.GetType();
            if (reader.IsDBNull(column))
            {
                value.Type = ColumnType.Null;
            }
            else if(typeof(bool).IsAssignableFrom(type))
            {
                value.Type = ColumnType.Boolean;
            }
            else if(typeof(int).IsAssignableFrom(type))
            {
                value.Type = ColumnType.Integer;
            }
            else if (typeof(float).IsAssignableFrom(type) || typeof(double).IsAssignableFrom(type))
            {
                value.Type = ColumnType.Double;
            }
            else if (typeof(byte[]).IsAssignableFrom(type))
            {
                value.Type = ColumnType.Blob;
            }
            else
            {
                value.Type = ColumnType.String;
            }

            return value;
        }
开发者ID:harryrose,项目名称:SQLGenerator,代码行数:34,代码来源:SQLServerDataAccess.cs

示例14: GetListOfEmployersAdmin

        // Populates the grid view of all the employers for Admin Secion

        public List<Employer> GetListOfEmployersAdmin()
        {
            List<Employer> ListOfEmployersAdmin = new List<Employer>();

            try
            {
                using (SqlConnection Cxn = new SqlConnection(CxnString))
                {
                    using (SqlCommand Cmd = new SqlCommand("spGetEmployersAdmin", Cxn))
                    {
                        Cxn.Open();
                        dr = Cmd.ExecuteReader();

                        while (dr.Read())
                        {

                            Employer AdminEmployer = new Employer();

                            int empID = Convert.ToInt32(dr.GetValue(Convert.ToInt32(Emp_GetObject.SP_GetEmpID)));
                            string empUsername = dr.GetValue(Convert.ToInt32(Emp_GetObject.SP_GetEmpUsername)).ToString();
                            string empEmail = dr.GetValue(Convert.ToInt32(Emp_GetObject.SP_GetEmpEmail)).ToString();
                            string empPhone = dr.GetValue(Convert.ToInt32(Emp_GetObject.SP_GetEmpPhone)).ToString();

                            AdminEmployer.EmployerID = empID;
                            AdminEmployer.EmployerUsername = empUsername;
                            AdminEmployer.EmployerEmail = empEmail;
                            AdminEmployer.EmployerPhone = empPhone;

                            ListOfEmployersAdmin.Add(AdminEmployer);

                        }

                        Cxn.Close();
                        dr.Close();
                    }
                }

            }
            catch (SqlException ex)
            {
                
                throw;
            }

            return ListOfEmployersAdmin;

        }
开发者ID:lorca4555,项目名称:JobSiteWebApp,代码行数:49,代码来源:DALRecruiterWebsiteManager.cs

示例15: GetCityInfo

        public static CityInfo GetCityInfo(SqlDataReader reader)
        {
            var city = DataContractFactory.CreateCityInfo();

            city.Id = reader.GetValue<long>(0);
            city.Latitude = (double) reader.GetValue<int>(1)/GeoConstants.GeoFactor;
            city.Longitude = (double) reader.GetValue<int>(2)/GeoConstants.GeoFactor;
            city.Name = reader.GetValue<string>(3);
            city.District = reader.GetValue<string>(4);
            city.Region = reader.GetValue<string>(5);
            city.Suffix = reader.GetValue<string>(6);
            city.CladrCode = reader.GetValue<string>(7);
            city.PostCode = reader.GetValue<string>(8);
            city.Fullname = reader.GetValue<string>(9);

            return city;
        }
开发者ID:abaula,项目名称:DistanceBtwCities,代码行数:17,代码来源:CityInfoDbAdapter.cs


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