In my code I can open a sql channel ok.
However I cant get it to read a table with a username and password field.
I get username not a valid object error.
string connectionString = @"Server = (localdb)\MSSQLLocalDB; connect timeout=30; database=Database1; Integrated Security = false; "; SqlConnection connection = new SqlConnection(); connection.ConnectionString = connectionString; try { connection.Open(); } catch (Exception err) { Console.WriteLine(err.ToString()); } try { SqlDataReader myReader = null; SqlCommand myCommand2 = new SqlCommand( "SELECT * from [username];", connection); myReader = myCommand2.ExecuteReader(); while (myReader.Read()) { TextBox1.Text = myReader["username"].ToString(); } } catch (Exception er) { Console.WriteLine(er.ToString()); }