Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#3.0 MS-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:29pm
Edited 31-Jan-12 23:37pm
v2
Comments
manognya kota at 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 at 1-Feb-12 6:29am
   
thanks sridhar..
Member 7976636 at 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
0 OriginalGriff 339
1 DineshMaind 95
2 Sergey Alexandrovich Kryukov 94
3 majid torfi 85
4 kbrandwijk 75
0 Zubair MCA 55
1 OriginalGriff 55
2 sankarsan parida 55
3 harshavardhan12345678 45
4 Sandeep Londhe 45


Advertise | Privacy | Mobile
Web01 | 2.8.140827.1 | Last Updated 1 Feb 2012
Copyright © CodeProject, 1999-2014
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