i am trying to display data from a database to the text box and keep getting the following error.
Error 1 The type or namespace name ‘DataTable’ could not be found (are you missing a using directive or an assembly reference?)
SqlConnection sqlConnection = new SqlConnection("joanton7865org7272_youthpodcastConnectionString");
sqlConnection .Open();
SqlDataAdapter sqlDataAdapter = new SqlDataAdapter("Select * from States", sqlConnection);
DataTable dt = new DataTable();
sqlDataAdapter.Fill(dt);
txtClubName.Text = (dt.Rows.Count > 0) ? Convert.ToString(dt.Rows[0]["ColumnName"]) : "";
sqlConnection .Open();
Click on the
DataTableand right mouse click and then clickResolve. This will give you two options. One will addusing System.Data;and the other will doSystem.Data.DataTable.You could use the shortcut as well:
Alt+Shift+F10