Connecting ASP.NET to SQL Server Application Roles

G

Graeme

I'm trying to connect an ASP.NET to a SQL Server application role but can't
find how to keep the connection between pages.

My initial page asks the user for their SQL Server username and logon.

I then do the following:

Create a connection string using the user's logon and password;
Create a new sqlclient.sqlconnection object using this string.
Create a new SqlClient.SqlCommand object.
Open the connection using the command.
If it opens ok, use the executenonquery command to execute the sp_addapprole
stored procedure on SQL Server (sending the applicaion role and application
role password);
Transfer control to a webform page.

How do I keep the connection when I transfer to the new page?

Graeme
 
S

Sin Min

Hi!

Before you move to the next page, I believe you have closed the connection
(best practise to close every connection after use). You then have to open
the connection again in your 2nd page if data access is required.


Regards,
Sin Min
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top