HelpMeDataView

A

Adam

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
 
C

Cor Ligthert

Adam,

Please stay in the original thread. I just made an answer there, this
confuses.

Prosze zostan w lini orinalu.

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top