|
if (! IsPostBack)
{
Ranch
string strConn = "Data Source = cnshangh601p; uid = accpac; pwd = accpac; Initial Catalog = ELSH";
SqlConnection sqlcn = new SqlConnection (strConn);
sqlcn.Open ();
SqlCommand selectCmd2 = new SqlCommand ("Select * From ReportUser where UserType = 2", sqlcn);
SqlDataReader dr2;
dr2 = selectCmd2.ExecuteReader ();
while (dr2.Read ())
{
UserList.Items.Add (new ListItem (dr2 ["UserName"]. ToString (), dr2 ["LogName"]. ToString ()));
}
dr2.Close ();
sqlcn.Close ();
The list items in my program are directly formed using the above code,
Control specified autopostback
I am good at executing the program when changing the list options,
result. . . .
Each time the option is changed, the list is repeated with the results of the above procedure. . That's the part of the while statement. . No matter how you change the program. . .
Ranch
} |
|