Click here to Skip to main content
12,954,856 members (75,174 online)
Rate this:
 
Please Sign up or sign in to vote.
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:

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:29pm
Updated 31-Jan-12 23:37pm
v2
Comments
manognya kota 1-Feb-12 5:37am
   
Added pre tag.

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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: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)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,539
CHill60 3,490
Maciej Los 3,153
ppolymorphe 2,030
Jochen Arndt 1,975


Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 1 Feb 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100