hi all,
i have some issues on excute the following query:
select max(TransactionNo) from tblDailyLoanpayInfo i want to find the maximum value of particular query(Above).
i would like to assign max value =1 when the table is empty.
pls anyone help me.
below is my coding:
--------------------------
SqlConnection con=new SqlConnection(StrCS);
SqlDataReader dr;
string query = "select Max(TransactionNo) from tblDailyLoanpayInfo";
SqlCommand cmd = new SqlCommand(query, con);
con.Open();
dr = cmd.ExecuteReader();
if (dr.Read()==true)
{
//Response.Write("availa");
Tranc =Convert.ToInt32(dr[0].ToString());
Tranc = Tranc + 1;
}
else
{
// Response.Write("not");
Tranc = 1;
}
con.Close();
txttrnsno.Text = Tranc.ToString();
Thanks
Thanks
tvn