473,427 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,427 software developers and data experts.

Why uses dabase connection always ASPNET user?

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(ConfigurationS ettings.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
Nov 19 '05 #1
2 1347
Lacka 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
Nov 19 '05 #2
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.

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Mike | last post by:
I'm trying to connect to a SQL db, I have the db setup as a DSN on my machine, here is my connection string that i'm trying to use. string dbConn = "Provider=sqloeldb;data source=Tech;Initial...
1
by: Bucky Pollard | last post by:
I have a web service that needs to create a batch file and call it (since there are no APIs for the functionality I am looking for). I am using the Process and ProcessStartInfo objects. When I try...
4
by: rrober07 | last post by:
Hello, My Setup is I have a Web Server machine(Devweb01), Database SQL Machine(Devsql01), a Client Machine(local machine) I have configured the SQL machine as follows: 1) Added local Aspnet...
1
by: lloyd | last post by:
i am trying to connect to SQL 7.0 using the following connection string myConnectString = "Initial Catalog=;Data Source=localhost;Integrated Security=SSPI;" i always the get the following error...
14
by: Mr.KisS | last post by:
Hi, How to change the account that ASP.NET uses for this virtual directory to one that has rights to the SQL Server box. Or how to use impersonation set in the Web.config file for the asp...
18
by: Jon Delano | last post by:
Hey all I am building a new computer. I have Windows XP Pro with SP2 and all the updates. I installed VS 2003. Then copied a project from my old computer to the new one. When I try and run...
1
by: kito | last post by:
Hi, I have a problem, when I want to access to my SQL Server Express database from my ASP.NET application. My workstation ID is KITOLAP-HP My username is user01 Now I built the following...
0
by: Chris Davoli | last post by:
We are changing from using SQL accounts in our connection string to use NT domain accounts. I have found some coe which I am using successfully on my local machine, because the installed account...
8
by: Brett | last post by:
I wrote an ASP.NET application that queries a SQL Server database (on a different box from the web server) and displays the result in a GridView. The datasource for the GridView is a SQLDataSource....
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.