Click here to Skip to main content
16,004,944 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Directly insertion from grid view Pin
Abhijit Jana18-Mar-09 0:01
professionalAbhijit Jana18-Mar-09 0:01 
QuestionHow to design in div tag Pin
ais0717-Mar-09 23:34
ais0717-Mar-09 23:34 
AnswerRe: How to design in div tag Pin
Subin Alex18-Mar-09 1:00
Subin Alex18-Mar-09 1:00 
AnswerRe: How to design in div tag Pin
N a v a n e e t h18-Mar-09 1:01
N a v a n e e t h18-Mar-09 1:01 
Questionhow to export stored procedures from local sql server 2000 to microsoft sql server Pin
somasekhara77717-Mar-09 22:22
somasekhara77717-Mar-09 22:22 
AnswerRe: how to export stored procedures from local sql server 2000 to microsoft sql server Pin
Abhijit Jana17-Mar-09 22:37
professionalAbhijit Jana17-Mar-09 22:37 
AnswerRe: how to export stored procedures from local sql server 2000 to microsoft sql server Pin
Herman<T>.Instance18-Mar-09 8:14
Herman<T>.Instance18-Mar-09 8:14 
Questiondatatable filter expression...... Pin
RajpootRohan17-Mar-09 22:19
professionalRajpootRohan17-Mar-09 22:19 
Hi to all,

I have in a datatable select method. I am unable to find what is going wrong.
Please give some guidance.

I am trying to do like this:

public void get_data()
{
    try
    {
        pro_id = Request.QueryString["pr_id"];
        quanti = Convert.ToInt32(Request.QueryString["quant"]);

        if (pro_id != null)
        {
            SqlConnection con = new SqlConnection("Server=.; Database=eclsc; Trusted_Connection=yes");
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = con;
            cmd.CommandText = "select ICEMACHINES.product_id,ICEMACHINES.sh_desc,ICEMACHINES.price from ICEMACHINES where ICEMACHINES.product_id LIKE @product_id union select GLASSWARE.product_id,GLASSWARE.sh_desc,GLASSWARE.price from GLASSWARE where GLASSWARE.product_id LIKE @product_id ";
            cmd.Parameters.Add("@product_id", SqlDbType.NVarChar, 50).Value = pro_id;
            cmd.Connection.Open();
            SqlDataReader rdr = cmd.ExecuteReader();
            ArrayList arRole1 = new ArrayList();

            while (rdr.Read())
            {
                desc = (rdr["sh_desc"]).ToString();
                id = (rdr["product_id"]).ToString();
                unitprice = Convert.ToSingle((rdr["price"]));
                cost = unitprice * quanti;

            }
            cmd.Connection.Close();

            DataRow myrow = dt.NewRow();
            myrow["REF"] = id;
            myrow["Description"] = desc;
            myrow["QTY"] = quanti;
            myrow["Price"] = unitprice;
            myrow["Cost"] = cost;

             int dtcount = dt.Rows.Count;
             if (dtcount > 0)
            {
            DataRow[] arrMatchingValues = dt.Select("REF=" + id);
            if (arrMatchingValues.Length > 0)
            {
                DataRow drUpdateMe = arrMatchingValues[0];
                int drUpdateQuant = Convert.ToInt32(drUpdateMe["QTY"]);
                int quan = quanti + drUpdateQuant;
                drUpdateMe["QTY"] = quan;
                dt.AcceptChanges();
            }
            }
            else
            {
                dt.Rows.Add(myrow);
                dt.AcceptChanges();
            }

            Session["data"] = dt;
            GridView1.DataSource = dt;
            GridView1.DataBind();


        }
        else
        {
            int a = 1;
        }
        total_items = total_items + quanti;
        total_Price = total_Price + cost;
        Session["items"] = total_items;
        Session["value"] = total_Price;
    }
    catch(Exception ee)
    {
        Lblmsg.Text = ee.Message;
    }
    }


The problem is in the filter expression. Actually I am trying that if a item already exists in the gridview then only the quantity should be updated.But I am unable to do this.
Please give some suggestions..

cheers,
sneha

AnswerRe: datatable filter expression...... Pin
venu65617-Mar-09 23:06
venu65617-Mar-09 23:06 
GeneralRe: datatable filter expression...... Pin
RajpootRohan17-Mar-09 23:50
professionalRajpootRohan17-Mar-09 23:50 
AnswerRe: datatable filter expression...... Pin
rajmca.g17-Mar-09 23:13
rajmca.g17-Mar-09 23:13 
GeneralRe: datatable filter expression...... Pin
rajmca.g17-Mar-09 23:16
rajmca.g17-Mar-09 23:16 
GeneralRe: datatable filter expression...... Pin
RajpootRohan17-Mar-09 23:53
professionalRajpootRohan17-Mar-09 23:53 
GeneralRe: datatable filter expression...... Pin
rajmca.g18-Mar-09 0:08
rajmca.g18-Mar-09 0:08 
GeneralRe: datatable filter expression...... Pin
RajpootRohan18-Mar-09 0:16
professionalRajpootRohan18-Mar-09 0:16 
GeneralRe: datatable filter expression...... Pin
Member 282342118-Mar-09 0:49
Member 282342118-Mar-09 0:49 
QuestionMaster Page Pin
Member 322226417-Mar-09 21:58
Member 322226417-Mar-09 21:58 
AnswerRe: Master Page Pin
Abhishek Sur17-Mar-09 22:09
professionalAbhishek Sur17-Mar-09 22:09 
AnswerRe: Master Page Pin
Christian Graus17-Mar-09 23:43
protectorChristian Graus17-Mar-09 23:43 
QuestionDynamic user control Pin
Subin Alex17-Mar-09 21:52
Subin Alex17-Mar-09 21:52 
AnswerRe: Dynamic user control Pin
Abhishek Sur17-Mar-09 22:07
professionalAbhishek Sur17-Mar-09 22:07 
GeneralRe: Dynamic user control Pin
Subin Alex17-Mar-09 23:20
Subin Alex17-Mar-09 23:20 
Questionproblem with web.config Pin
rajmca.g17-Mar-09 21:47
rajmca.g17-Mar-09 21:47 
AnswerRe: problem with web.config Pin
Abhishek Sur17-Mar-09 22:05
professionalAbhishek Sur17-Mar-09 22:05 
QuestionMaster page? Pin
Karthick_gc17-Mar-09 21:33
Karthick_gc17-Mar-09 21:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.