To generate 1+ value in combobox from a integer column of sql server
Dear Friends I have to generate 1+ value from maximum available in column of table for that I have one stored procedure As shown below
ALTER procedure generateid
as
begin
select max("pid")+1 from pinfo
end
And in datalayer i have called it in this way
public DataSet generateid()
{
con = new SqlConnection("integrated security=true;database=hm");
cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "generateid";
da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, "pinfo");
return ds;
}
and from front end I have tried to get value in following way
DL gi = new DL();
DataSet ds = gi.generateid ();
comboBox1 .DataSource = ds.Tables["pinfo"] ;
comboBox1 .DisplayMember = "pid";
but it is coming as System.Data.DataRowView
please suggest me solution