Solved

SQL Password on connection

Posted on 2008-06-10
6
187 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

Author Comment

by:ratkinso666
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks for your help Shawn
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

743 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now