I have read some codes like following:
///////////////////////////////////////////
SqlConnection* conn =
new SqlConnection(S"Server=localhost;"
S"Database=Northwind;"
S"Integrated Security=true;");
adapter = new SqlDataAdapter(S"SELECT * FROM Employees", conn);
eventHandler = new SqlEventHandler(adapter, this);
commandBuilder = new SqlCommandBuilder(adapter);
conn->Open();
///////////////////////////////////////////
I wondered can we link to the database without username and password?
Tim - 13 Jun 2005 10:43 GMT
In your example, you are doing exactly that - you are using a Trusted
Connection aka Integrated Security aka SSPI context. The Trusted connection
is the logged on connection you already have. This needs to be setup in SQL
Server.
The alternative is to specify a UserName and Password in the SqlConnection -
this username and password has to be registered in SQL Server with
permissions to the database(s) and objects you require.
- Tim
>I have read some codes like following:
> ///////////////////////////////////////////
[quoted text clipped - 13 lines]
>
> I wondered can we link to the database without username and password?