If I run the following code on my development machine as a "Windows
Application", it works. If I run the following code on my development
machine as an "ASP.NET Web Application", I get the error "SQL Server does not
exist or access denied." when trying to open the connection. I would
appreciate any assistance in determining why.

Private Sub TestAdo()
Dim conn As New System.Data.SqlClient.SqlConnection
Dim cmd As New System.Data.SqlClient.SqlCommand
Dim dr As System.Data.SqlClient.SqlDataReader
conn.ConnectionString = "Data
Source=np:SQLSERVER1;uid=username;pwd=password;Initial
Catalog=STARMT;Connection Timeout=5;"
conn.Open()
cmd.Connection = conn
cmd.CommandText = "select * from customers"
dr = cmd.ExecuteReader()
Do While dr.Read
'
Loop
dr.Close()
conn.Close()
End Sub


Thanks in advance.

Clay

Re: Connection string does not work from asp.net web application by Val

Val
Sat Nov 13 13:44:22 CST 2004

Hi,

It means that most likely you do not have permissions for ASPNET account to
access SQL Server database. Check if your ASPNET account exists in a list of
the users for login in a SQL Server database. You would also need to grant
permissions for ASPNET account to run specific SPs or access specific tables

--
Val Mazur
Microsoft MVP


"Clay" <Clay@discussions.microsoft.com> wrote in message
news:47191814-F4A9-407B-BA04-45B9E50B9BE2@microsoft.com...
>
> If I run the following code on my development machine as a "Windows
> Application", it works. If I run the following code on my development
> machine as an "ASP.NET Web Application", I get the error "SQL Server does
> not
> exist or access denied." when trying to open the connection. I would
> appreciate any assistance in determining why.
>
> Private Sub TestAdo()
> Dim conn As New System.Data.SqlClient.SqlConnection
> Dim cmd As New System.Data.SqlClient.SqlCommand
> Dim dr As System.Data.SqlClient.SqlDataReader
> conn.ConnectionString = "Data
> Source=np:SQLSERVER1;uid=username;pwd=password;Initial
> Catalog=STARMT;Connection Timeout=5;"
> conn.Open()
> cmd.Connection = conn
> cmd.CommandText = "select * from customers"
> dr = cmd.ExecuteReader()
> Do While dr.Read
> '
> Loop
> dr.Close()
> conn.Close()
> End Sub
>
>
> Thanks in advance.
>
> Clay
>



Re: Connection string does not work from asp.net web application by jeff

jeff
Sat Nov 13 15:33:15 CST 2004

No, he's passing in the username and password in the connection string.

What happens if you drop a DataAdapter on the form, and go through the
Wizard? You can then view the connection string created

Jeff

"Val Mazur" <group51a@hotmail.com> wrote in message
news:OQhmrkbyEHA.3024@TK2MSFTNGP14.phx.gbl...
> Hi,
>
> It means that most likely you do not have permissions for ASPNET account
to
> access SQL Server database. Check if your ASPNET account exists in a list
of
> the users for login in a SQL Server database. You would also need to grant
> permissions for ASPNET account to run specific SPs or access specific
tables
>
> --
> Val Mazur
> Microsoft MVP
>
>
> "Clay" <Clay@discussions.microsoft.com> wrote in message
> news:47191814-F4A9-407B-BA04-45B9E50B9BE2@microsoft.com...
> >
> > If I run the following code on my development machine as a "Windows
> > Application", it works. If I run the following code on my development
> > machine as an "ASP.NET Web Application", I get the error "SQL Server
does
> > not
> > exist or access denied." when trying to open the connection. I would
> > appreciate any assistance in determining why.
> >
> > Private Sub TestAdo()
> > Dim conn As New System.Data.SqlClient.SqlConnection
> > Dim cmd As New System.Data.SqlClient.SqlCommand
> > Dim dr As System.Data.SqlClient.SqlDataReader
> > conn.ConnectionString = "Data
> > Source=np:SQLSERVER1;uid=username;pwd=password;Initial
> > Catalog=STARMT;Connection Timeout=5;"
> > conn.Open()
> > cmd.Connection = conn
> > cmd.CommandText = "select * from customers"
> > dr = cmd.ExecuteReader()
> > Do While dr.Read
> > '
> > Loop
> > dr.Close()
> > conn.Close()
> > End Sub
> >
> >
> > Thanks in advance.
> >
> > Clay
> >
>
>



Re: Connection string does not work from asp.net web application by Val

Val
Sun Nov 14 22:26:59 CST 2004

Do you want to say that passing user and password in a connection string is
not allowed?

--
Val Mazur
Microsoft MVP


<jeff@removeemergencyreporting.com> wrote in message
news:OloothcyEHA.3808@tk2msftngp13.phx.gbl...
> No, he's passing in the username and password in the connection string.
>
> What happens if you drop a DataAdapter on the form, and go through the
> Wizard? You can then view the connection string created
>
> Jeff
>
> "Val Mazur" <group51a@hotmail.com> wrote in message
> news:OQhmrkbyEHA.3024@TK2MSFTNGP14.phx.gbl...
>> Hi,
>>
>> It means that most likely you do not have permissions for ASPNET account
> to
>> access SQL Server database. Check if your ASPNET account exists in a list
> of
>> the users for login in a SQL Server database. You would also need to
>> grant
>> permissions for ASPNET account to run specific SPs or access specific
> tables
>>
>> --
>> Val Mazur
>> Microsoft MVP
>>
>>
>> "Clay" <Clay@discussions.microsoft.com> wrote in message
>> news:47191814-F4A9-407B-BA04-45B9E50B9BE2@microsoft.com...
>> >
>> > If I run the following code on my development machine as a "Windows
>> > Application", it works. If I run the following code on my development
>> > machine as an "ASP.NET Web Application", I get the error "SQL Server
> does
>> > not
>> > exist or access denied." when trying to open the connection. I would
>> > appreciate any assistance in determining why.
>> >
>> > Private Sub TestAdo()
>> > Dim conn As New System.Data.SqlClient.SqlConnection
>> > Dim cmd As New System.Data.SqlClient.SqlCommand
>> > Dim dr As System.Data.SqlClient.SqlDataReader
>> > conn.ConnectionString = "Data
>> > Source=np:SQLSERVER1;uid=username;pwd=password;Initial
>> > Catalog=STARMT;Connection Timeout=5;"
>> > conn.Open()
>> > cmd.Connection = conn
>> > cmd.CommandText = "select * from customers"
>> > dr = cmd.ExecuteReader()
>> > Do While dr.Read
>> > '
>> > Loop
>> > dr.Close()
>> > conn.Close()
>> > End Sub
>> >
>> >
>> > Thanks in advance.
>> >
>> > Clay
>> >
>>
>>
>
>



Re: Connection string does not work from asp.net web application by Jeff

Jeff
Sun Nov 14 22:41:58 CST 2004

You mentioned the ASPNET account, I mentioned that he's connecting via
Standard SQL auth, it appears.

Jeff
"Val Mazur" <group51a@hotmail.com> wrote in message
news:u5dSXtsyEHA.2600@TK2MSFTNGP09.phx.gbl...
> Do you want to say that passing user and password in a connection string
is
> not allowed?
>
> --
> Val Mazur
> Microsoft MVP
>
>
> <jeff@removeemergencyreporting.com> wrote in message
> news:OloothcyEHA.3808@tk2msftngp13.phx.gbl...
> > No, he's passing in the username and password in the connection string.
> >
> > What happens if you drop a DataAdapter on the form, and go through the
> > Wizard? You can then view the connection string created
> >
> > Jeff
> >
> > "Val Mazur" <group51a@hotmail.com> wrote in message
> > news:OQhmrkbyEHA.3024@TK2MSFTNGP14.phx.gbl...
> >> Hi,
> >>
> >> It means that most likely you do not have permissions for ASPNET
account
> > to
> >> access SQL Server database. Check if your ASPNET account exists in a
list
> > of
> >> the users for login in a SQL Server database. You would also need to
> >> grant
> >> permissions for ASPNET account to run specific SPs or access specific
> > tables
> >>
> >> --
> >> Val Mazur
> >> Microsoft MVP
> >>
> >>
> >> "Clay" <Clay@discussions.microsoft.com> wrote in message
> >> news:47191814-F4A9-407B-BA04-45B9E50B9BE2@microsoft.com...
> >> >
> >> > If I run the following code on my development machine as a "Windows
> >> > Application", it works. If I run the following code on my
development
> >> > machine as an "ASP.NET Web Application", I get the error "SQL Server
> > does
> >> > not
> >> > exist or access denied." when trying to open the connection. I would
> >> > appreciate any assistance in determining why.
> >> >
> >> > Private Sub TestAdo()
> >> > Dim conn As New System.Data.SqlClient.SqlConnection
> >> > Dim cmd As New System.Data.SqlClient.SqlCommand
> >> > Dim dr As System.Data.SqlClient.SqlDataReader
> >> > conn.ConnectionString = "Data
> >> > Source=np:SQLSERVER1;uid=username;pwd=password;Initial
> >> > Catalog=STARMT;Connection Timeout=5;"
> >> > conn.Open()
> >> > cmd.Connection = conn
> >> > cmd.CommandText = "select * from customers"
> >> > dr = cmd.ExecuteReader()
> >> > Do While dr.Read
> >> > '
> >> > Loop
> >> > dr.Close()
> >> > conn.Close()
> >> > End Sub
> >> >
> >> >
> >> > Thanks in advance.
> >> >
> >> > Clay
> >> >
> >>
> >>
> >
> >
>
>



Re: Connection string does not work from asp.net web application by Clay

Clay
Mon Nov 15 09:16:02 CST 2004

Jeff,

Thanks for the tip. The connection string created by the sqldataadapter
worked.

Turns out it has to do with trying to connect using named pipes from my
asp.net app. I did try using tcp with my original connection string and that
failed aswell, but this new connection string through tcp works fine. Thanks
again.

Here is new connection string i'm using that works:
"workstation id=DEVCOMP;packet size=4096;user
id=username;Password=password;data source=SQLSERVER1;persist security
info=False;initial catalog=STARMT"

"jeff@removeemergencyreporting.com" wrote:

> No, he's passing in the username and password in the connection string.
>
> What happens if you drop a DataAdapter on the form, and go through the
> Wizard? You can then view the connection string created
>
> Jeff
>
> "Val Mazur" <group51a@hotmail.com> wrote in message
> news:OQhmrkbyEHA.3024@TK2MSFTNGP14.phx.gbl...
> > Hi,
> >
> > It means that most likely you do not have permissions for ASPNET account
> to
> > access SQL Server database. Check if your ASPNET account exists in a list
> of
> > the users for login in a SQL Server database. You would also need to grant
> > permissions for ASPNET account to run specific SPs or access specific
> tables
> >
> > --
> > Val Mazur
> > Microsoft MVP
> >
> >
> > "Clay" <Clay@discussions.microsoft.com> wrote in message
> > news:47191814-F4A9-407B-BA04-45B9E50B9BE2@microsoft.com...
> > >
> > > If I run the following code on my development machine as a "Windows
> > > Application", it works. If I run the following code on my development
> > > machine as an "ASP.NET Web Application", I get the error "SQL Server
> does
> > > not
> > > exist or access denied." when trying to open the connection. I would
> > > appreciate any assistance in determining why.
> > >
> > > Private Sub TestAdo()
> > > Dim conn As New System.Data.SqlClient.SqlConnection
> > > Dim cmd As New System.Data.SqlClient.SqlCommand
> > > Dim dr As System.Data.SqlClient.SqlDataReader
> > > conn.ConnectionString = "Data
> > > Source=np:SQLSERVER1;uid=username;pwd=password;Initial
> > > Catalog=STARMT;Connection Timeout=5;"
> > > conn.Open()
> > > cmd.Connection = conn
> > > cmd.CommandText = "select * from customers"
> > > dr = cmd.ExecuteReader()
> > > Do While dr.Read
> > > '
> > > Loop
> > > dr.Close()
> > > conn.Close()
> > > End Sub
> > >
> > >
> > > Thanks in advance.
> > >
> > > Clay
> > >
> >
> >
>
>
>