public abstract class clscon { protected SqlConnection con = new SqlConnection(); public clscon() { con.ConnectionString = ConfigurationManager.ConnectionStrings["cn"].ConnectionString; } }
public class clscon1 : clscon { public void OpenConnection() { con.Open(); } }
public Int32 GetAuto() { nsDal.clscon1 con1 = new nsDal.clscon1(); con1.OpenConnection();
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "Select isnull(max(orgcod),0) from tborg"; Int32 v_no = Convert.ToInt32(cmd.ExecuteScalar()); cmd.Dispose(); return v_no + 1; }