pankajs

pankajs

  • NA
  • 1
  • 0

How to auto generate scheme no

Mar 21 2005 1:39 AM
Hi, actually m trying 2 generate a new scheme no. by tallying the combination of above selected values from the drop downs, if the same combination is present there for 2 times then it will display scheme number as 3 in the following textbox. can anybody plzz help me out i have written followind code on selection of the fourth dropdown: SqlCommand insertCmd=new SqlCommand("select max(Schemeno) from Approvalrelease where Plancode=@Plancode and Stcode=@Stcode and Citycode=@Citycode and Schemecode=@Schemecode and Rivercode=@Rivercode", myConnectionn); insertCmd.Connection.Open(); insertCmd.Parameters.Add(new SqlParameter("@Plancode",SqlDbType.NVarChar)).Value=DropDownList1.SelectedValue.ToString(); insertCmd.Parameters.Add(new SqlParameter("@Stcode",SqlDbType.NVarChar)).Value=DropDownList2.SelectedValue.ToString(); insertCmd.Parameters.Add(new SqlParameter("@Citycode",SqlDbType.NVarChar)).Value=DropDownList3.SelectedValue.ToString(); insertCmd.Parameters.Add(new SqlParameter("@Schemecode",SqlDbType.NVarChar)).Value=DropDownList5.SelectedValue.ToString(); insertCmd.Parameters.Add(new SqlParameter("@Rivercode",SqlDbType.NVarChar)).Value=DropDownList4.SelectedValue.ToString(); SqlDataReader dr=insertCmd.ExecuteReader(); dr.ToString()="Schemeno"; int SchemeNo=0; SchemeNo=SchemeNo+1; TextBox1.Text=dr.ToString(); TextBox1.DataBind(); reagrds, pankaj