Click here to Skip to main content
15,900,667 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi everybody,

i am doing a project in c# with msaccess.the value in decimal places in a textbox is not updating to the database as i given.how to write the query for storing the values.

this is my coding:

C#
string str1 = "select * from itemmaster where itemcode = " + V_Code1 + " and status=false";
                    OleDbDataReader dr1 = con.GetDB(str1);
                    if (dr1.Read())
                    {
                        string str2 = "update itemmaster set itemcode=" + V_Code1 + ",medName='" + txtmedname.Text + "',batchcode='" + txtbatchcode.Text + "',groupcode= " + V_GroupCode + ",uomcode=" + V_UOMCode + ",mfrcode=" + V_mfrcode + ",expirydate=#" + dtpdate.Value.ToString() + "#,mrp=" + Convert.ToDecimal(txtmrp.Text) + ",abtmrp=" + Convert.ToDecimal(txtabatedrate.Text) + ",salesrate=" + Convert.ToDecimal(txtsalesrate.Text) + ",rackcode=" + V_rackcode + ",status=false where itemcode = " + V_Code1 + "";
                        con.SetDB(str2);
                        dr1.Close();
                        MessageBox.Show("Medicine Details Updated.", "Message...", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }

                    else
                    {
                        string str = "insert into itemmaster values(" + V_Code1 + ",'" + txtmedname.Text + "','" + txtbatchcode.Text + "', '" + V_GroupCode + "','" + V_UOMCode + "','" + V_mfrcode + "','" + dtpdate.Value.ToString() + "','" + txtmrp.Text + "','" + txtabatedrate.Text + "','" + txtsalesrate.Text + "','" + V_rackcode + "','0')";
                        con.SetDB(str);
                        MessageBox.Show("Medicine Details Saved.", "Message...", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
Posted
Updated 31-Jan-12 23:37pm
v2
Comments
manognya kota 1-Feb-12 5:37am    
Added pre tag.

1 solution

Use Numeric text box in the place of text box.
then you can get the value like this

Float k=Text1.value;    //In the place of text1.text


Thanks.
 
Share this answer
 
Comments
Member 7976636 1-Feb-12 6:29am    
thanks sridhar..
Member 7976636 1-Feb-12 6:35am    
but sridhar
there is no such kind of textbox available ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900