September 22, 2011 at 7:52 am
If I use asp.net to connect SQL 2008, what account should create in SQL server?
September 22, 2011 at 8:11 am
I don't understand your question. Can you please clarify? Are you asking which sql server should you use to connect to your database?
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
September 22, 2011 at 8:24 am
Sorry, my question is:
Should I nedd to create a special account in SQL server in order for ASP.NET to connect database?
September 22, 2011 at 8:27 am
create a new login, for example "WebAccess", then add a user to the database the web pages will access.
create a role for the appropriate rights,a nd finallly , put WebAccess in that role.
here's a basic example
-- add specific users
IF NOT EXISTS (SELECT * FROM MASTER.dbo.syslogins WHERE name = N'WebAccess')
BEGIN
EXEC MASTER.dbo.sp_addlogin @loginame = N'WebAccess', @passwd = 'NotARealPassword', @defdb = N'WHATEVER', @deflanguage = N'us_english'
--add this user to permit read and write
END
USE [WHATEVER]
--make a user in the db for the matching login
CREATE USER [WebAccess] FOR LOGIN [WebAccess]
--create the Role for my web pages
CREATE ROLE [StandardWebAccess]
EXEC sp_addrolemember N'StandardWebAccess','db_datareader'
EXEC sp_addrolemember N'StandardWebAccess','db_datawriter'
GRANT EXECUTE TO [StandardWebAccess]
--add these logs to the role
EXEC sp_addrolemember N'StandardWebAccess', N'WebAccess'
Lowell
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply