473,231 Members | 1,865 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,231 software developers and data experts.

ConnectionString For SQL Server 2005?

I recently installed SQL Server 2005 (Management Studio Express) along
with SQL Server 2005 Express (Configuration Manager) in my Win2K Pro
m/c & use IIS 5.0 to run ASPX projects. I could add my database, named
"MyDB", successfully. I am using the Windows Authentication mode to
login to SQL Server. My server name is "AD\SQLEXPRESS" where "AD" is
the name of my m/c.

I could even establish a connection to the server & the database from
Visual Web Developer 2005 by navigating to "Tools--->"Connect to
Database" menu. The next dialog listed a list of data sources from
which I selected Microsoft SQL Server. In the subsequent dialog titled
"Add Connection", the "Data Source" was already set as "Microsoft SQL
Server (SqlClient)". In the "Server name" textbox, I entered the SQL
Server name i.e "AD/SQLEXPRESS". The "Select or enter a database name"
field listed all the databases from which I chose "MyDB". Next when I
clicked the "Test Connection" button, VWD prompted a message saying
"Test connection succeeded". After clicking the OK button in this
dialog, the "Database Explorer" window pane opened up in VWD which
listed the SQL Server name along with the database name i.e.
"ad\sqlexpress.MyDB.dbo". "MyDB" also listed all the objects like
tables, stored procedures, triggers etc.

The problem I am facing right now is in framing the ConnectionString in
ASPX pages using VWD. The "Database Explorer" window pane shows the
ConnectionString as

Data Source=AD\SQLEXPRESS;Initial Catalog=MyDB;Integrated Security=True

& this is how the ConnectionString looks in the Page_Load sub:

<script runat="server">
Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs)
Dim dSet As DataSet
Dim sqlConn As SqlConnection
Dim sqlDapter As SqlDataAdapter

sqlConn = New SqlConnection("Data Source=AD\SQLEXPRESS;Initial
Catalog=MyDB;Integrated Security=True")
sqlDapter = New SqlDataAdapter("SELECT * FROM Users", sqlConn)

dSet = New DataSet()
sqlDapter.Fill(dSet, "Users")
........................
........................
........................
End Sub
</script>

But the above code generates the following error:

Cannot open database "MyDB" requested by the login. The login failed.
Login failed for user 'AD\ASPNET'.

Can someone please guide me what am I missing in the ConnectionString?
I believe it's a security/permission issue but just can't figure out
the cause of the error.

My entire work has come to a standstill just because of this problem. I
need help desperately!

Please note that prior to using SQL Server 2005, I was using SQL Server
7.0 & this was the ConnectionString I used to use:

sqlConn = New SqlConnection("Server=(local);Database=MyDB;UID=sa ;PWD=")

Using the above ConnectionString, I didn't face any problem while
retrieving data from a SQL Server 7.0 database table.

Thanks,

Arpan.

Aug 3 '06 #1
3 3133
Arpan have you give the database the right permissions?
Go to Sql Server and give the 'AD\ASPNET' account the right permissions.
Patrick
"Arpan" <ar******@hotmail.comwrote in message
news:11*********************@75g2000cwc.googlegrou ps.com...
>I recently installed SQL Server 2005 (Management Studio Express) along
with SQL Server 2005 Express (Configuration Manager) in my Win2K Pro
m/c & use IIS 5.0 to run ASPX projects. I could add my database, named
"MyDB", successfully. I am using the Windows Authentication mode to
login to SQL Server. My server name is "AD\SQLEXPRESS" where "AD" is
the name of my m/c.

I could even establish a connection to the server & the database from
Visual Web Developer 2005 by navigating to "Tools--->"Connect to
Database" menu. The next dialog listed a list of data sources from
which I selected Microsoft SQL Server. In the subsequent dialog titled
"Add Connection", the "Data Source" was already set as "Microsoft SQL
Server (SqlClient)". In the "Server name" textbox, I entered the SQL
Server name i.e "AD/SQLEXPRESS". The "Select or enter a database name"
field listed all the databases from which I chose "MyDB". Next when I
clicked the "Test Connection" button, VWD prompted a message saying
"Test connection succeeded". After clicking the OK button in this
dialog, the "Database Explorer" window pane opened up in VWD which
listed the SQL Server name along with the database name i.e.
"ad\sqlexpress.MyDB.dbo". "MyDB" also listed all the objects like
tables, stored procedures, triggers etc.

The problem I am facing right now is in framing the ConnectionString in
ASPX pages using VWD. The "Database Explorer" window pane shows the
ConnectionString as

Data Source=AD\SQLEXPRESS;Initial Catalog=MyDB;Integrated Security=True

& this is how the ConnectionString looks in the Page_Load sub:

<script runat="server">
Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs)
Dim dSet As DataSet
Dim sqlConn As SqlConnection
Dim sqlDapter As SqlDataAdapter

sqlConn = New SqlConnection("Data Source=AD\SQLEXPRESS;Initial
Catalog=MyDB;Integrated Security=True")
sqlDapter = New SqlDataAdapter("SELECT * FROM Users", sqlConn)

dSet = New DataSet()
sqlDapter.Fill(dSet, "Users")
........................
........................
........................
End Sub
</script>

But the above code generates the following error:

Cannot open database "MyDB" requested by the login. The login failed.
Login failed for user 'AD\ASPNET'.

Can someone please guide me what am I missing in the ConnectionString?
I believe it's a security/permission issue but just can't figure out
the cause of the error.

My entire work has come to a standstill just because of this problem. I
need help desperately!

Please note that prior to using SQL Server 2005, I was using SQL Server
7.0 & this was the ConnectionString I used to use:

sqlConn = New SqlConnection("Server=(local);Database=MyDB;UID=sa ;PWD=")

Using the above ConnectionString, I didn't face any problem while
retrieving data from a SQL Server 7.0 database table.

Thanks,

Arpan.

Aug 3 '06 #2
Thanks, for your prompt response, Patrick.
Go to Sql Server and give the 'AD\ASPNET' account the right permissions
I don't find the 'AD\ASPNET' account in the SQL Server Management
Studio Express IDE. How do I give the 'AD\ASPNET' account the right
permissions?

Thanks once again,

Regards,

Arpan
Patrick.O.Ige wrote:
Arpan have you give the database the right permissions?
Go to Sql Server and give the 'AD\ASPNET' account the right permissions.
Patrick
"Arpan" <ar******@hotmail.comwrote in message
news:11*********************@75g2000cwc.googlegrou ps.com...
I recently installed SQL Server 2005 (Management Studio Express) along
with SQL Server 2005 Express (Configuration Manager) in my Win2K Pro
m/c & use IIS 5.0 to run ASPX projects. I could add my database, named
"MyDB", successfully. I am using the Windows Authentication mode to
login to SQL Server. My server name is "AD\SQLEXPRESS" where "AD" is
the name of my m/c.

I could even establish a connection to the server & the database from
Visual Web Developer 2005 by navigating to "Tools--->"Connect to
Database" menu. The next dialog listed a list of data sources from
which I selected Microsoft SQL Server. In the subsequent dialog titled
"Add Connection", the "Data Source" was already set as "Microsoft SQL
Server (SqlClient)". In the "Server name" textbox, I entered the SQL
Server name i.e "AD/SQLEXPRESS". The "Select or enter a database name"
field listed all the databases from which I chose "MyDB". Next when I
clicked the "Test Connection" button, VWD prompted a message saying
"Test connection succeeded". After clicking the OK button in this
dialog, the "Database Explorer" window pane opened up in VWD which
listed the SQL Server name along with the database name i.e.
"ad\sqlexpress.MyDB.dbo". "MyDB" also listed all the objects like
tables, stored procedures, triggers etc.

The problem I am facing right now is in framing the ConnectionString in
ASPX pages using VWD. The "Database Explorer" window pane shows the
ConnectionString as

Data Source=AD\SQLEXPRESS;Initial Catalog=MyDB;Integrated Security=True

& this is how the ConnectionString looks in the Page_Load sub:

<script runat="server">
Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs)
Dim dSet As DataSet
Dim sqlConn As SqlConnection
Dim sqlDapter As SqlDataAdapter

sqlConn = New SqlConnection("Data Source=AD\SQLEXPRESS;Initial
Catalog=MyDB;Integrated Security=True")
sqlDapter = New SqlDataAdapter("SELECT * FROM Users", sqlConn)

dSet = New DataSet()
sqlDapter.Fill(dSet, "Users")
........................
........................
........................
End Sub
</script>

But the above code generates the following error:

Cannot open database "MyDB" requested by the login. The login failed.
Login failed for user 'AD\ASPNET'.

Can someone please guide me what am I missing in the ConnectionString?
I believe it's a security/permission issue but just can't figure out
the cause of the error.

My entire work has come to a standstill just because of this problem. I
need help desperately!

Please note that prior to using SQL Server 2005, I was using SQL Server
7.0 & this was the ConnectionString I used to use:

sqlConn = New SqlConnection("Server=(local);Database=MyDB;UID=sa ;PWD=")

Using the above ConnectionString, I didn't face any problem while
retrieving data from a SQL Server 7.0 database table.

Thanks,

Arpan.
Aug 3 '06 #3
Patrick, I got the problem resolved. What I did is expanded the DB
named "MyDB" in the SQL Server Management Studio Express, then expanded
"Security" & finally expanded "Users". Right-clicking "Users", I added
a new user. In the dialog that popped-up, I entered 'AD\ASPNET' as the
"Login name", a name in the "User name" field & finally assigned
"db_owner" as the "Database role membership".

That's it!

Regards,

Arpan

Arpan wrote:
Thanks, for your prompt response, Patrick.
Go to Sql Server and give the 'AD\ASPNET' account the right permissions

I don't find the 'AD\ASPNET' account in the SQL Server Management
Studio Express IDE. How do I give the 'AD\ASPNET' account the right
permissions?

Thanks once again,

Regards,

Arpan
Patrick.O.Ige wrote:
Arpan have you give the database the right permissions?
Go to Sql Server and give the 'AD\ASPNET' account the right permissions.
Patrick
"Arpan" <ar******@hotmail.comwrote in message
news:11*********************@75g2000cwc.googlegrou ps.com...
>I recently installed SQL Server 2005 (Management Studio Express) along
with SQL Server 2005 Express (Configuration Manager) in my Win2K Pro
m/c & use IIS 5.0 to run ASPX projects. I could add my database, named
"MyDB", successfully. I am using the Windows Authentication mode to
login to SQL Server. My server name is "AD\SQLEXPRESS" where "AD" is
the name of my m/c.
>
I could even establish a connection to the server & the database from
Visual Web Developer 2005 by navigating to "Tools--->"Connect to
Database" menu. The next dialog listed a list of data sources from
which I selected Microsoft SQL Server. In the subsequent dialog titled
"Add Connection", the "Data Source" was already set as "Microsoft SQL
Server (SqlClient)". In the "Server name" textbox, I entered the SQL
Server name i.e "AD/SQLEXPRESS". The "Select or enter a database name"
field listed all the databases from which I chose "MyDB". Next when I
clicked the "Test Connection" button, VWD prompted a message saying
"Test connection succeeded". After clicking the OK button in this
dialog, the "Database Explorer" window pane opened up in VWD which
listed the SQL Server name along with the database name i.e.
"ad\sqlexpress.MyDB.dbo". "MyDB" also listed all the objects like
tables, stored procedures, triggers etc.
>
The problem I am facing right now is in framing the ConnectionString in
ASPX pages using VWD. The "Database Explorer" window pane shows the
ConnectionString as
>
Data Source=AD\SQLEXPRESS;Initial Catalog=MyDB;Integrated Security=True
>
& this is how the ConnectionString looks in the Page_Load sub:
>
<script runat="server">
Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs)
Dim dSet As DataSet
Dim sqlConn As SqlConnection
Dim sqlDapter As SqlDataAdapter
>
sqlConn = New SqlConnection("Data Source=AD\SQLEXPRESS;Initial
Catalog=MyDB;Integrated Security=True")
sqlDapter = New SqlDataAdapter("SELECT * FROM Users", sqlConn)
>
dSet = New DataSet()
sqlDapter.Fill(dSet, "Users")
........................
........................
........................
End Sub
</script>
>
But the above code generates the following error:
>
Cannot open database "MyDB" requested by the login. The login failed.
Login failed for user 'AD\ASPNET'.
>
Can someone please guide me what am I missing in the ConnectionString?
I believe it's a security/permission issue but just can't figure out
the cause of the error.
>
My entire work has come to a standstill just because of this problem. I
need help desperately!
>
Please note that prior to using SQL Server 2005, I was using SQL Server
7.0 & this was the ConnectionString I used to use:
>
sqlConn = New SqlConnection("Server=(local);Database=MyDB;UID=sa ;PWD=")
>
Using the above ConnectionString, I didn't face any problem while
retrieving data from a SQL Server 7.0 database table.
>
Thanks,
>
Arpan.
>
Aug 3 '06 #4

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

Similar topics

4
by: Devante | last post by:
Hi, I am fairly new to ASP.NET and have been working on a web form that will allow a user to upload images to a database. I have found a sample web form that I have been trying to get working,...
8
by: Ben R. | last post by:
Hi all, This is a multipart question. I’ve got an asp.net site that contains an access database. Previously, I would debug by making changes and uploading to my host. Now, I’d like to be...
1
by: TeeCo | last post by:
Hi folks. I'm trying to change the location of the Access mdb file I connect to using OleDb and am having trouble. I'm using Visual C# 2005 and the default values I use for the ConnectionString...
3
by: Jim Andersen | last post by:
Hi, I would appreciate if someone could explain this behaviour, and maybe offer a better solution. I have been working with the GridView control. And SqlDataSource. It works great if I do:...
0
by: trihanhcie | last post by:
Hello I'm using entityspaces with Mygeneration to create data access layers. However, while it works perfectly with SQL server 2005, it looks like it doesn't with Oracle. In my web.config,...
5
by: Radu | last post by:
Hi. In a repeater I have as ItemTemplate the following, among others, and everything works great: <asp:SqlDataSource ID="LocationSqlDataSource" SelectCommand="SELECT blah-blah-blah"...
1
by: priyamtheone | last post by:
What's the connectionstring to connect to the Oracle9.0 Database Server irrespective of servername,username and password using VB.Net2002 (.Net framework 1.0)? In case of Microsoft SQL Server the...
2
by: gggram2000 | last post by:
Hi, I'm using visual studio 2005 with sql server 2005. I made a program on my computer that works great. I wanted to transfer the same project through a remote connection to another computer, I...
4
by: RN1 | last post by:
I use SQL Server 2005 Management Studio Express as the database. For ASP files to connect to SQL Server 2005, I am using the following ConnectionString: <% Dim objConn Set...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, youll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

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.