473,699 Members | 2,768 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

increment value of textbox and save it in the database

5 New Member
I have a text box invoice no on windows form and i need to retrieve data from database and everytime user click on the add button the invoice no should increment by 1
Dec 24 '12 #1
7 11120
PsychoCoder
465 Recognized Expert Moderator Contributor
Bytes.com isn't a code or homework service, we're a community of like minded people who come together to help those who are willing to help themselves.

Show us what you've tried and we will do everything we can to nudge you in the right direction but we will not just do the work for you.
Dec 24 '12 #2
Salin786
5 New Member
Expand|Select|Wrap|Line Numbers
  1. private void button3_Click(object sender, EventArgs e)
  2.         {
  3.             con.Open();
  4.             da = new SqlDataAdapter("Select UserId from tab_userinformation ",con);
  5.             ds = new DataSet();
  6.             da.Fill(ds);
  7.             textBox1.Text = ds.Tables[0].Rows[0][0].ToString();
  8.             con.Close();
  9.         }
Dec 24 '12 #3
Salin786
5 New Member
Expand|Select|Wrap|Line Numbers
  1. textbox.text = Convert.ToString(Convert.ToInt(textbox.text) + 1)
incrementing the User id Bt i am getting it 302 instead of 301
Dec 24 '12 #4
Salin786
5 New Member
i have just put it up my code
Dec 24 '12 #5
PsychoCoder
465 Recognized Expert Moderator Contributor
I'm not understanding what it is you're having trouble with, or what you're trying to accomplish for that matter.
Dec 24 '12 #6
hoemach
1 New Member
Have you tried DMax +1?
Dec 24 '12 #7
adriancs
122 New Member
use auto-increment int primary key and column data type.
the database will do it for you automatically.
Jan 14 '13 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

4
4629
by: Jack | last post by:
Hi, I have a checkbox the value which goes to a database via a asp page that builds the sql string. In the front end asp page, the checkbox code is written as follows: <i><input type="checkbox" name="chk_Complete" value="<%Response.Write l_IsChecked%>"<%if cbool(l_IsChecked) then Response.Write " checked"%>> The code to captures the checkbox value in the asp page that builds the sql string is follows
1
1106
by: COHENMARVIN | last post by:
Suppose I have a listbox with 4 values: VISA, MC, DISCOVER, AMEX. I read a value out of a database as follows: myReader("CreditCardType") Now I want to set the listbox selection to the value in the database. Do I have to loop through every line of the listbox until I find one that matches? Or is there an easier way? I tried CreditCardType.SelectedItem.Value = myReader("CreditCardType") but that gives me an error message
3
1567
shek124
by: shek124 | last post by:
i have a text box on my form. i want to insert the value from the textbox to database.. im the beginner of vb.net .. plz help me .. thanks in advance..
4
5043
by: Sonasang | last post by:
Hi , I am creating webpage in ASP. In that page i am using 2 radio button..... Male and female If onclick event fires for the radiobutton i have to update the value in the database as male (if i checked the male)..... Using Javascript i am getting the value of the radiobutton value and placing them in the hiddenbox and then in the ASP code i get the value of the hiddenbox using request.form and then update the same value in the...
5
2662
by: Germaris | last post by:
Hi there! How should I write a query to get the next auto-increment value of a table? Many thanks in advance for any help. Best regards, Gerry
1
2198
by: apoorva varma | last post by:
I want to fetch data into a textbox from database.plz tell me the coding in c#
3
18209
by: raamay | last post by:
hey experts, please advise me what is the best way to save multiple checkboxes value in a database. I have 6 checkboxes and i came across storing the values in a single column of a table which i dont want to implement as the checkbox values may be used for search purpose in latter stage. Apart from that i also came across creating individual columns for each checkbox which i feel would really make my table large. Is there any other way that i...
1
4236
AaronL
by: AaronL | last post by:
Hello, First I would like to say thank you all for your help in the past. I am stumped again. I am creating an e-commerce system and I want to be able to upload images to the server and assign them to products. For the product ID, I have an auto increment value for the primary key to avoid duplicate item numbers. Since I do not want to pass all of my record values to my image upload program (when I write it), I assume to just submit...
2
14655
by: qwedster | last post by:
Folk! How to programattically check if null value exists in database table (using stored procedure)? I know it's possble in the Query Analyzer (see last SQL query batch statements)? But how can I pass null value as parameter to the database stored procedure programattically using C#? Although I can check for empty column (the following code passes string.Empty as parameter but how to pass null value?), I cannot check for null value...
0
9173
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9033
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8911
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6533
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4375
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4627
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3057
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2345
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2009
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.