A
Adam
Hi I have code
It read from date base, table "lastname" the data and I would like
put to dr[0] - array
The code
{
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();
string lastName = string.Empty;
SqlDataReader dr1 = cmd.ExecuteReader();
dr1.Read();
/////////////////////////////////////////////
//DataTable dt = new DataTable();
// DataRow dr;
//dt.Columns.Add(new DataColumn("IntegerValue",
typeof(Int32)));
//dt.Columns.Add(new DataColumn("StringValue",
typeof(string)));
while(dr1.Read())
{
lastName=dr1["lastname"].ToSring());
}
But I have erron in 31 line
Description: An error occurred during the compilation of a resource
required to service this request. Please review the following specific
error details and modify your source code appropriately.
Compiler Error Message: CS1002: ; expected
Help me
It read from date base, table "lastname" the data and I would like
put to dr[0] - array
The code
{
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();
string lastName = string.Empty;
SqlDataReader dr1 = cmd.ExecuteReader();
dr1.Read();
/////////////////////////////////////////////
//DataTable dt = new DataTable();
// DataRow dr;
//dt.Columns.Add(new DataColumn("IntegerValue",
typeof(Int32)));
//dt.Columns.Add(new DataColumn("StringValue",
typeof(string)));
while(dr1.Read())
{
lastName=dr1["lastname"].ToSring());
}
But I have erron in 31 line
Description: An error occurred during the compilation of a resource
required to service this request. Please review the following specific
error details and modify your source code appropriately.
Compiler Error Message: CS1002: ; expected
Help me