A
Adam Macko
Ok
Sorry
This code read dr[0] and dr[1] from
DataTable dt = new DataTable();
DataRow dr;
dt.Columns.Add(new DataColumn("IntegerValue", typeof(Int32)));
dt.Columns.Add(new DataColumn("StringValue", typeof(string)));
for (int i = 0; i < SqlDataReader dr1.Read(); i++)
{
dr = dt.NewRow();
dr[0] = i;
dr[1] = "Item " + i.ToString();
dt.Rows.Add(dr);
}
DataView dv = new DataView(dt);
return dv;
but I would like that this code read from table "lastname" from database
String strConn = "DATABASE=Northwind;SERVER=localhost;UID=sa;PWD=;";
SqlConnection conn = new SqlConnection(strConn);
String strCmd = "SELECT * FROM Employees ";
SqlCommand cmd = new SqlCommand(strCmd, conn);
conn.Open();
SqlDataReader dr1 = cmd.ExecuteReader();
dr1.Read();
//MoreInfo.Text = BuildMoreInfoText(dr);
What I have to do it
Please, help me
Sorry
This code read dr[0] and dr[1] from
DataTable dt = new DataTable();
DataRow dr;
dt.Columns.Add(new DataColumn("IntegerValue", typeof(Int32)));
dt.Columns.Add(new DataColumn("StringValue", typeof(string)));
for (int i = 0; i < SqlDataReader dr1.Read(); i++)
{
dr = dt.NewRow();
dr[0] = i;
dr[1] = "Item " + i.ToString();
dt.Rows.Add(dr);
}
DataView dv = new DataView(dt);
return dv;
but I would like that this code read from table "lastname" from database
String strConn = "DATABASE=Northwind;SERVER=localhost;UID=sa;PWD=;";
SqlConnection conn = new SqlConnection(strConn);
String strCmd = "SELECT * FROM Employees ";
SqlCommand cmd = new SqlCommand(strCmd, conn);
conn.Open();
SqlDataReader dr1 = cmd.ExecuteReader();
dr1.Read();
//MoreInfo.Text = BuildMoreInfoText(dr);
What I have to do it
Please, help me