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
To generate 1+ value in combobox from a integer column of sql server
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Ritesh Diyawar101 reputationPosted Nov 13, 2010, 12:14 AM EST
this proc return a single value and single column , u should change the proc and increase one more column .
us should assign the value in valuemember property of combobox
if u want show only single value in dropdown then why use combobox u should use labek or textbox etc.