I would like to know how can I get from database sql a value from a cell? Example table name : login columns:
Name | Birthday
Ina 19
string name = "Select Name from login";
string connection= "connection string path";
SqlConnection connect = new SqlConnection(connection);
SqlCommand command = new sqlCommand(name,connect);
string get = command;
but I'm sure it's wrong :(
I would like to know how to get the value?
Thanks,
You want command.ExecuteScalar()
string get = command.ExecuteScalar().ToString();
You may need to be careful of the possibility of getting a null back from the command too.