| | |
Auto generation of numbers..
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jan 2008
Posts: 25
Reputation:
Solved Threads: 0
Hi all webbers,
I have a problem of generating numbers automatically....
Actually i have a textbox and the textbox should autogenerate a number everytime the page loads or whenever the user clicks the next button after filling in the values.....
Help me out dudes.......Sample code would help me a lot.....
I have a problem of generating numbers automatically....
Actually i have a textbox and the textbox should autogenerate a number everytime the page loads or whenever the user clicks the next button after filling in the values.....
Help me out dudes.......Sample code would help me a lot.....
Last edited by bharathi_n_r; Jan 19th, 2008 at 2:35 am.
•
•
Join Date: Jan 2008
Posts: 25
Reputation:
Solved Threads: 0
I am using the numbers for serializing my datas..The numbers should generate automatically like 1 for the first record 2 for the second 3, 4 ,5 etc...But the number should continue even he logs out and logs in next time.The form contains Issue number, Name,Address,Issue Date etc...I want the issue number to get generated automatically.....I hope it clears ur question...!
•
•
Join Date: Jan 2008
Posts: 25
Reputation:
Solved Threads: 0
Dude,
I managed to generate the numbers,but i have a little problem.I have given this code in my page load event to fetch the last record from the database and increment the value of issue_no by one.It is incrementing the value but once i click the add button after filling other details,the next number is not getting incremented after the button click,any suggestion man....It is getting incremented after i sttoped and then running my program again....
I want the next no to be incremented so that the user can enter multiple datas without closing the application....
I managed to generate the numbers,but i have a little problem.I have given this code in my page load event to fetch the last record from the database and increment the value of issue_no by one.It is incrementing the value but once i click the add button after filling other details,the next number is not getting incremented after the button click,any suggestion man....It is getting incremented after i sttoped and then running my program again....
I want the next no to be incremented so that the user can enter multiple datas without closing the application....
C# Syntax (Toggle Plain Text)
Con = new SqlConnection("Data Source=PSTLCORPSERV;Initial Catalog=Error;Persist Security Info=True;User ID=sa;Password=sqlserver12#"); Con.Open(); Cmd = new SqlCommand("select issue_no from error", Con); Data = Cmd.ExecuteReader(); while (Data.Read() != false) { auto = Data.GetString(0); } try { int newid = Int32.Parse(auto); int id = newid + 1; this.textBox1.Text = id.ToString() + ""; } catch (Exception ex) { MessageBox.Show(ex.Message + ex.Source); } Data.Close();
Last edited by bharathi_n_r; Jan 21st, 2008 at 2:47 am.
your code is true but did a little more.
make the procedure or function to generate auto number only. so you can call this procedure or function after you add,edit,delete or clear form.
make the procedure or function to generate auto number only. so you can call this procedure or function after you add,edit,delete or clear form.
Last edited by Jx_Man; Jan 22nd, 2008 at 3:47 pm.
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
So, Please do something before post your thread.
* PM Asking will be ignored *
![]() |
Similar Threads
Other Threads in the C# Forum
- Previous Thread: Running my application outside the enviroment
- Next Thread: question in C#
| Thread Tools | Search this Thread |
.net access ado.net algorithm angle array barchart bitmap box broadcast buttons c# capturing check checkbox client color combobox control conversion convert csharp custom database datagrid datagridview dataset datetime degrees delegate development disappear draganddrop drawing encryption enum event excel file form format forms function gdi+ geometry httpwebrequest image index input install java label leak list listbox mandelbrot math monodevelop mouseclick msword mysql operator path pause photoshop picturebox pixelinversion post programming radians regex remote remoting richtextbox round serialization server sleep socket sql statistics stream string table text textbox thread time timer update usercontrol validation virtualization visualbasic visualstudio webbrowser windows winforms wpf xml






