B
bthumber
I have a project class. The method GetRecordCover returns a dataset:
public DataTable GetRecordCover(string id)
{
string str = “SELECT * FROM RecordCover WHERE=’†+ “id†+ “’â€;
SqlConnection cn = new SqlConnection(_connectionString);
SqlDataAdapter da = new SqlDataAdapter(sql, cn);
DataSet ds = new DataSet();
da.Fill(ds, “RecordCoverâ€);
// Get data table
DataTable dt = ds.Tables[“RecordCoverâ€];
Return ds.Tables[0];
//ds.Tables[0].Rows[0][0];
//ds.Tables[0].Rows[0][1];
//ds.Tables[0].Rows[0][2];
}
In the web form's code behind I want:
RecordCover rc = new RecordCover();
label1.text = how do populate my label with ds.Tables[0].Rows[0][0];
label2.text = how do populate my label with ds.Tables[0].Rows[0][1];
label3.text = how do populate my label with ds.Tables[0].Rows[0][2]; ???
public DataTable GetRecordCover(string id)
{
string str = “SELECT * FROM RecordCover WHERE=’†+ “id†+ “’â€;
SqlConnection cn = new SqlConnection(_connectionString);
SqlDataAdapter da = new SqlDataAdapter(sql, cn);
DataSet ds = new DataSet();
da.Fill(ds, “RecordCoverâ€);
// Get data table
DataTable dt = ds.Tables[“RecordCoverâ€];
Return ds.Tables[0];
//ds.Tables[0].Rows[0][0];
//ds.Tables[0].Rows[0][1];
//ds.Tables[0].Rows[0][2];
}
In the web form's code behind I want:
RecordCover rc = new RecordCover();
label1.text = how do populate my label with ds.Tables[0].Rows[0][0];
label2.text = how do populate my label with ds.Tables[0].Rows[0][1];
label3.text = how do populate my label with ds.Tables[0].Rows[0][2]; ???