예제 #1
0
        private void BindGridView()
        {
            SqlConnection con1 = new SqlConnection(_ConnStr);

            //where RFQ_UserID = '" + Session["M_Subscriber_UserID"].ToString() + "'
            con1.Open();

            SqlCommand     cmd   = new SqlCommand("select RFQ_Slno,RFQ_Number,RFQ_Company,RFQ_CreationDate,RFQ_OriginCountry,RFQ_DestinationCountry,RFQ_OriginAirport,RFQ_DestinationAirport,RFQ_NumberofPackages,RFQ_TotalGrwt,RFQ_TotalVolwt,RFQ_TotalChwt,RFQ_PickupAddress,RFQ_DeliveryAddress,RFQ_PickupDate,RFQ_ReqTT,RFQ_QuoteDueBy,RFQ_Commodity,RFQ_HandlingInfo,RFQ_UserID,RFQ_Timestamp,RFQ_Submit,RFQ_ExpectedPrice from RFQ where RFQ_UserID = '" + Session["M_Subscriber_UserID"].ToString() + "' ", con1);
            SqlDataAdapter darfq = new SqlDataAdapter(cmd);
            DataSet        dsrfq = new DataSet();

            darfq.Fill(dsrfq);
            GridViewRfq.DataSource = dsrfq;
            GridViewRfq.DataBind();
            lbltotalcount.Text = GridViewRfq.Rows.Count.ToString();

            con1.Close();
        }
예제 #2
0
 protected void Refresh(object sender, ImageClickEventArgs e)
 {
     using (SqlConnection conn = new SqlConnection())
     {
         conn.ConnectionString = _ConnStr;
         SqlCommand cmd = conn.CreateCommand();
         cmd.CommandText = "select * from RFQ where RFQ_UserID = '" + Session["M_Subscriber_UserID"].ToString() + "' order by RFQ_Number ";
         cmd.CommandType = System.Data.CommandType.Text;
         DataTable dTable = new DataTable();
         if (conn.State == ConnectionState.Closed)
         {
             conn.Open();
         }
         SqlDataReader dReader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
         dTable.Load(dReader);
         GridViewRfq.DataSource = dTable;
         GridViewRfq.DataBind();
     }
 }
예제 #3
0
        private void BindGrid()
        {
            String constr = ConfigurationManager.ConnectionStrings["CrudConnection"].ConnectionString;

            using (SqlConnection con = new SqlConnection(constr))
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.CommandText = "select RFQ_Slno,RFQ_Number,RFQ_Company,RFQ_CreationDate,RFQ_OriginCountry,RFQ_DestinationCountry,RFQ_OriginAirport,RFQ_DestinationAirport,RFQ_NumberofPackages,RFQ_TotalGrwt,RFQ_TotalVolwt,RFQ_TotalChwt,RFQ_PickupAddress,RFQ_DeliveryAddress,RFQ_PickupDate,RFQ_ReqTT,RFQ_QuoteDueBy,RFQ_Commodity,RFQ_HandlingInfo,RFQ_ExpectedPrice,RFQ_UserID,RFQ_Timestamp,RFQ_ExpectedPrice,RFQ_Submit from RFQ WHERE RFQ_Number LIKE '%'+@RFQ_Number+'%' AND RFQ_UserID = '" + Session["M_Subscriber_UserID"].ToString() + "' ";
                    cmd.Connection  = con;
                    cmd.Parameters.AddWithValue("@RFQ_Number", txtSearch.Text.Trim());


                    DataTable dt = new DataTable();
                    using (SqlDataAdapter sda = new SqlDataAdapter(cmd))
                    {
                        sda.Fill(dt);
                        GridViewRfq.DataSource = dt;
                        GridViewRfq.DataBind();
                    }
                }
            }
        }