Click here to Skip to main content
Sign Up to vote bad
good
See more: C#3.0MS-Access
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:
 
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 31 Jan '12 - 23:29
Edited 31 Jan '12 - 23:37

Comments
manognya kota - 1 Feb '12 - 5:37
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.
  Permalink  
Comments
Member 7976636 - 1 Feb '12 - 6:29
thanks sridhar..
Member 7976636 - 1 Feb '12 - 6:35
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)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 564
1 CPallini 245
2 Mahesh Bailwal 239
3 Maciej Los 235
4 Aarti Meswania 208
0 Sergey Alexandrovich Kryukov 9,162
1 OriginalGriff 7,179
2 CPallini 3,913
3 Rohan Leuva 3,176
4 Maciej Los 2,588


Advertise | Privacy | Mobile
Web04 | 2.6.130516.1 | Last Updated 1 Feb 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid