I want to fill in the first column of data from a DataTable into a textbox.
What is the syntax to do that.
I have this so far, but get an error on the last line.
DataTable dt = new DataTable();
string strConnection = ConfigurationManager.ConnectionStrings["ChinatowndbConnString"].ConnectionString;
SqlConnection conn = new SqlConnection(strConnection);
string sql = "SELECT * FROM vwSchedule where scheduleid =" + scheduleid;
SqlCommand cmd = new SqlCommand(sql);
cmd.CommandType = CommandType.Text;
cmd.Connection = conn;
SqlDataAdapter sd = new SqlDataAdapter(cmd);
sd.Fill(dt);
tbEvent.Text dt.Rows[0].Field<String>(0); // first field of first row, assuming that it's a string
Regards Tea