Hi,
My connection string is
"server='(local)'; trusted_connection=true; database=Lexiko; user id=lexiko;
pwd=lexiko"
but at the line "dataAdapter.Fill(dataSet)" I get the error: Login failed
for user 'LSW2KP\ASPNET' until I create this user for the database.
Why do my application want to connect with the user "ASPNET" insteed of
using "lexiko" described in the connection string? What's wrong?
Here is the complete sequence (the connection string mentioned above is in
the app setting "DB"):
Dim dbConnection As System.Data.IDbConnection = New
System.Data.SqlClient.SqlConnection(ConfigurationSettings.AppSettings("DB"))
Dim dbCommand As System.Data.IDbCommand = New
System.Data.SqlClient.SqlCommand
Dim dataAdapter As System.Data.IDbDataAdapter = New
System.Data.SqlClient.SqlDataAdapter
Dim dataSet As System.Data.DataSet = New System.Data.DataSet
dbCommand.Connection = dbConnection
dbCommand.CommandText = "SELECT * FROM MY_TABLE"
dataAdapter.SelectCommand = dbCommand
dataAdapter.Fill(dataSet)
thanks,
LackaLacka wrote:
> Hi,
> My connection string is
> "server='(local)'; trusted_connection=true; database=Lexiko; user
> id=lexiko; pwd=lexiko"
> but at the line "dataAdapter.Fill(dataSet)" I get the error: Login
> failed for user 'LSW2KP\ASPNET' until I create this user for the
> database.
> Why do my application want to connect with the user "ASPNET" insteed
> of using "lexiko" described in the connection string? What's wrong?
Just omit "trusted_connection=true" from your connection string.
trusted_connection=true means that the connection should use
Windows authentication, while the user id and password are
meant for SQL Server authentication.
Edge
Thanks, now works fine.
> Just omit "trusted_connection=true" from your connection string.
> trusted_connection=true means that the connection should use
> Windows authentication, while the user id and password are
> meant for SQL Server authentication.
Monday, March 12, 2012
Why uses dabase connection always ASPNET user?
Labels:
asp,
aspnet,
connection,
dabase,
databaselexiko,
idlexikopwdlexiko,
line,
local,
net,
server,
string,
trusted_connectiontrue,
user
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment