T
tolkien
Hi,i'm new in c# and i want to do this:
I have installed MS Sql server in my pc.
I 'm trying to create a winform which "reads" from a table in a
database and prints its data .
My biggest problem is :how the hell do i connect with the sql
server!!!
The name of the server is TURBOX
the name of the database is MYBUSINESS
the name of the table is SALGRADE
what i wrote is thisI saw it in a tutorial )
string connectionString = "server=TURBOX; database=MYBUSINESS; uid=;
pwd=;";
SqlConnection conn = new SqlConnection(connectionString);
String commandString = "SELECT " + "GRADE,LOSAL,HISAL" + "FROM
SALGRADE";
SqlDataAdapter dataAdapter = new SqlDataAdapter(commandString, conn);
I didn't expect it to work of course
When i run this program i get an exception:
Login failed for user '(null)'. Reason: Not associated with a trusted
SQL Server connection.
I don't have a userid or a password
When i connect to the SQL server i use Windowns Authentication.
Any ideas?
Thanks anyway!!!!!!
I have installed MS Sql server in my pc.
I 'm trying to create a winform which "reads" from a table in a
database and prints its data .
My biggest problem is :how the hell do i connect with the sql
server!!!
The name of the server is TURBOX
the name of the database is MYBUSINESS
the name of the table is SALGRADE
what i wrote is thisI saw it in a tutorial )
string connectionString = "server=TURBOX; database=MYBUSINESS; uid=;
pwd=;";
SqlConnection conn = new SqlConnection(connectionString);
String commandString = "SELECT " + "GRADE,LOSAL,HISAL" + "FROM
SALGRADE";
SqlDataAdapter dataAdapter = new SqlDataAdapter(commandString, conn);
I didn't expect it to work of course
When i run this program i get an exception:
Login failed for user '(null)'. Reason: Not associated with a trusted
SQL Server connection.
I don't have a userid or a password
When i connect to the SQL server i use Windowns Authentication.
Any ideas?
Thanks anyway!!!!!!