Solved

SQL Password on connection

Posted on 2008-06-10
6
204 Views
Last Modified: 2013-11-30
Hi all, I have the following that works perfectly fine:

Dim da As New SqlDataAdapter
                Dim conn As SqlConnection = New SqlConnection("Data Source=SQLRPT;Initial Catalog=CorpReports;Persist Security Info=True;async=true;User ID=apps;Password=...")
                Dim cmd As New SqlCommand("hsp_rpt_GrossMargin_Web", conn)

BUT, I want to remove the passwords and use this as a trusted connection, like this:

 Dim da As New SqlDataAdapter
                Dim conn As SqlConnection = New SqlConnection("Data Source=SQLRPT;Initial Catalog=CorpReports;Persist Security Info=True;async=true;Trusted_Connection=Yes")
                Dim cmd As New SqlCommand("hsp_rpt_GrossMargin_Web", conn)

Everything works fine for this when filling a grid or a dropdown or calling for data.  The problem I have is when calling a procedure,  it doesn't seem to want to let me do that.  It runs fine from my local machine, but not from the website.  I have given the server login all the permissions to login to the server and get to all of the Databases.  Like I said, it runs fine to allow me to edit, add or pull data from the databases, but will not allow me to run a procedure...

Thanks,
Randy
0
Comment
Question by:ratkinso666
  • 4
  • 2
6 Comments
 
LVL 5

Expert Comment

by:scgstuff
ID: 21752567
Try adding Execute permissions to the account the server is using.  I believe it is the ASPNET account on the web server's machine you will need to use.  It may be Network Service, but I think ASPNET is all you need.

Shawn
0
 

Author Comment

by:ratkinso666
ID: 21754993
In the Internet Services Manager???  I have changed everything in there I can see..  I did change it to do scripts and executables.  It still will not run the procedures though...
0
 
LVL 5

Accepted Solution

by:
scgstuff earned 500 total points
ID: 21755269
In the SQL Server Management Studio, set the permission for the DB to allow the accounts to execute.

Right click on the database
Click on Properties
Select Permissions from the list
Add user ASPNET (and you might want to try NT Authority/Network Service if that doesn't do it.)
Scroll down to Execute and check Grant
OK out of it and try again.

If the user does not show up in the pick list when you do this, you may need to:
Go to Security for the SQL Server (also in SSMS)
Right Click on Logins
Select New Login
Search for user and add

Shawn
0
Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

 

Author Comment

by:ratkinso666
ID: 21759304
OK, I found in the Stored Procedures (SQL 2000 by the way) where to add EXEC in the checkboxes, so I added that to my Web1$, which is our login, added ALL the checkboxes at the database level, which does not include the EXEC, and it still doesn't work...  runs fine from my local machine and my login isn't even in the list at all...

Thanks,
Randy
0
 

Author Comment

by:ratkinso666
ID: 21759909
Hi Shawn, I have decided to convert the ones that will not work to using connection strings that I will just have a password in the web.config file and that seems to work just fine.  I will just have to manually change that password every 6 months...

Thanks,
Randy
0
 

Author Closing Comment

by:ratkinso666
ID: 31465784
Thanks for your help Shawn
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Viewers will learn how the fundamental information of how to create a table.

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question