Why uses dabase connection always ASPNET user?

L

Lacka

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,
Lacka
 
E

Edge

Lacka said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top