?
Solved

SQL Password on connection

Posted on 2008-06-10
6
Medium Priority
?
220 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 

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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Suggested Courses

752 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