how do you generate source code for the automatic generation
for receipt number



how do you generate source code for the automatic generation for receipt number..

Answer / raviarsenal

C # in form load paste this code


try
{
SqlConnection con = new SqlConnection
(@"Data Source=.\sqlexpress;Initial
Catalog=Hospital;Integrated Security=True");
con.Open();
q = "select Billno from PatientBill";
SqlCommand cmd = new SqlCommand(q, con);
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
bill = Convert.ToInt32(dr
["Billno"].ToString());
}
txtbillno.Text = (bill + 1).ToString();
dr.Close();
cmd.Dispose();
con.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Programming Languages AllOther Interview Questions

One boy has to climb steps. He can climb 1 or 2 steps at a time. Write a function that will returns number of way a boy can climb the steps. Int WaytoSteps(int n) (eg:- suppose number of steps is n=4 ,the function will return 5 (one-one-one-one ,one-one-two, one-two-one-,two-one-one, two-two)

0 Answers   Persistent,


Write a shell program to test whether a given year is leap year or not ?

0 Answers   Patni,


Write a Pseudo Code to find the angle between two hands of a clock for a given time.

6 Answers   Goldman Sachs, HCL,


As per interoperatbility programs written in one language can be used by other language. How can we restrict the features of one language (say C#) in the programmer written in another language (say VB)..for example we have some features like operator overloading which is possible C#.NET (not in VB.NET), how can we restrict that when we are using this code in VB.NET.

0 Answers   Tesco,


Display names and numbers of employees who have 5 years or more experience and  salary less than Rs.15000 using array of structures (name, number, experience and  salary)

0 Answers  






An image map is a collection of

1 Answers   Velocis,


What ports must be open for DCOM over a firewall? What is the purpose of Port 135?

1 Answers  


What is a PID? How is it useful when troubleshooting a system?

3 Answers  


I want Ada programming language books. Could anyone post me any link for that?

0 Answers  


You are given some denominations of coins in an array (int denom[])and infinite supply of all of them. Given an amount (int amount), find the minimum number of coins required to get the exact amount. What is the method called?

0 Answers   Amazon,


What binary value will be internally stored for NULL for the type S9(1) COMP 3 in mainframe

0 Answers  


What is the effect of the OPTIONS statement ERRORS=1?

3 Answers   QSG, Quintiles, SAS,


Categories