<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>SQL Server, SQL Server Express, and SqlDataSource Control</title><link>http://forums.asp.net/54.aspx</link><description>All about SQL Server, SQL Server Express, MSDE, and the SqlDataSource control.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: Cannot open database requested in login 'dbName'. Login fails. Login failed for user 'machineName\ASPNET'</title><link>http://forums.asp.net/thread/1836699.aspx</link><pubDate>Thu, 02 Aug 2007 05:01:37 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1836699</guid><dc:creator>oneBottonSally</dc:creator><author>oneBottonSally</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1836699.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=54&amp;PostID=1836699</wfw:commentRss><description>&lt;p&gt;i can not do anything with sql. This is what i got :&lt;/p&gt;
&lt;p&gt;-------------------------------------------------------------------------------------------&lt;/p&gt;
&lt;p&gt;C:\Users\User&amp;gt;osql -E -S&lt;br /&gt;[SQL Native Client]VIA Provider: The specified module could not be found.&lt;br /&gt;[SQL Native Client]Login timeout expired&lt;br /&gt;[SQL Native Client]An error has occurred while establishing a connection to&lt;br /&gt;the server. When connecting to SQL Server 2005, this failure may be caused by&lt;br /&gt;the fact that under the default settings SQL Server does not allow remote&lt;br /&gt;connections.&lt;/p&gt;
&lt;p&gt;------------------------------------------------------------------------------------------&lt;/p&gt;
&lt;p&gt;also, i cant create database directly from SQL Server Management Studio Express! &lt;/p&gt;
&lt;p&gt;the error is The permission denied in database &amp;#39;master&amp;#39;. What should i do?&lt;/p&gt;</description></item><item><title>Re: Cannot open database requested in login 'dbName'. Login fails. Login failed for user 'machineName\ASPNET'</title><link>http://forums.asp.net/thread/1048555.aspx</link><pubDate>Sun, 11 Sep 2005 16:32:16 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1048555</guid><dc:creator>tmorton</dc:creator><author>tmorton</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1048555.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=54&amp;PostID=1048555</wfw:commentRss><description>After referring someone else to this post I realized that I never answered your questions.&amp;nbsp; I am sorry!&lt;br /&gt;
&lt;br /&gt;
&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/fan/images/icon-quote.gif"&gt; &lt;strong&gt;MEight:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;Thanxs &amp;#39;%orton&amp;#39;&lt;br /&gt;
I was able to grantlogin to
&amp;#39;machineName\ASPNET&amp;#39;, however, got an error stating that permissions
already existed for &amp;#39;machineName\ASPNET&amp;#39; when I tried to grantdbaccess.&lt;br /&gt;
&lt;/div&gt;&lt;/BLOCKQUOTE&gt; &lt;br /&gt;
Then you really didn&amp;#39;t need to do anything further with *that* command.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/fan/images/icon-quote.gif"&gt; &lt;strong&gt;MEight:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&amp;nbsp;I do have EnterpriseManager&amp;lt;snip&amp;gt;&lt;br /&gt;
But when I went
back ino the database/users, I didn&amp;#39;t see &amp;#39;machineName\ASPNET&amp;#39; in the
User list. Why is that?&lt;br /&gt;
&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;br /&gt;
Enterprise Manager is not good about refreshing data.&amp;nbsp; Either
close Enterprise Manager completely and reopen it, or start at your
server right-clicking and choosing Refresh on each node all of the way
down until you get to the node for the data you are concerned
with.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/fan/images/icon-quote.gif"&gt; &lt;strong&gt;MEight:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
Where can I look to see the results of
executing the sp_grantlogin &amp;amp; sp_grantdbaccess? Shouldn&amp;#39;t there be
a list for that somewhere?&lt;br /&gt;
&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;br /&gt;
You can see this in Enterprise Manager (after forcing the data to refresh), or you can execute the &lt;a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_sp_help_50mr.asp"&gt;sp_helplogins&lt;/a&gt; system stored procedure from Query Analyzer (or the osql commandline utility):&lt;br /&gt;
&lt;blockquote&gt;&lt;font face="Courier New"&gt;EXEC sp_helplogins&lt;/font&gt;&lt;br /&gt;
&lt;/blockquote&gt;
&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/fan/images/icon-quote.gif"&gt; &lt;strong&gt;MEight:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
And just to make sure that I
understand what is happening. The sp_grantlogin simply gives the user
&amp;#39;machineName\ASPNET&amp;#39; permission to login into the SQLServer (1st
level). Then sp_grantdbacess gives the user &amp;#39;machineName\ASPNET&amp;#39;
permission to access the specified database (from the use yourDatabase)&lt;br /&gt;
&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;br /&gt;
Yes, you&amp;#39;ve got it!&amp;nbsp; You can read up on what MSDN has to say about &lt;a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_sp_ga-gz_8dri.asp"&gt;sp_grantlogin&lt;/a&gt; and &lt;a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_sp_ga-gz_290z.asp"&gt;sp_grantdbaccess&lt;/a&gt; for more information.&lt;br /&gt;
&lt;br /&gt;
If you haven&amp;#39;t done so already, you should install &lt;a href="http://www.microsoft.com/sql/techinfo/productdoc/2000/books.mspx"&gt;SQL Server 2000 Books Online&lt;/a&gt;.&amp;nbsp; This is a great free SQL Server reference.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</description></item><item><title>Re: Cannot open database requested in login 'dbName'. Login fails. Login failed for user 'machineName\ASPNET'</title><link>http://forums.asp.net/thread/1003966.aspx</link><pubDate>Fri, 29 Jul 2005 14:40:17 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1003966</guid><dc:creator>MEight</dc:creator><author>MEight</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1003966.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=54&amp;PostID=1003966</wfw:commentRss><description>Thanxs '%orton'&lt;BR&gt;&lt;BR&gt;I went with tmorton's instructions because it looked easier and more straightforward. I&amp;nbsp;enabled&amp;nbsp;me to&amp;nbsp;get my app running after a few minor adjustments. I described what I did below but don't fully understand why&amp;nbsp;it worked. Could you please help clarify?&amp;nbsp;&lt;BR&gt;&lt;BR&gt;I was able to grantlogin to 'machineName\ASPNET', however, got an error stating that permissions already existed for 'machineName\ASPNET' when I tried to grantdbaccess. I do have EnterpriseManager and went into the Users of the database I needed to use. I deleted the 'machineName\ASPNET' from that list. Then ran the sp_grantdbaccess 'machineName\ASPNET' again. This time succeeding. Thus my application has permissions to run. But when I went back ino the database/users, I didn't see 'machineName\ASPNET' in the User list. Why is that?&lt;BR&gt;&lt;BR&gt;Where can I look to see the results of executing the sp_grantlogin &amp;amp; sp_grantdbaccess? Shouldn't there be a list for that somewhere?&lt;BR&gt;&lt;BR&gt;And just to make sure that I understand what is happening. The sp_grantlogin simply gives the user 'machineName\ASPNET' permission to login into the SQLServer (1st level). Then sp_grantdbacess gives the user 'machineName\ASPNET' permission to access the specified database (from the use yourDatabase)&lt;BR&gt;&lt;BR&gt;Thanxs again!!!</description></item><item><title>Re: Cannot open database requested in login 'dbName'. Login fails. Login failed for user 'machineName\ASPNET'</title><link>http://forums.asp.net/thread/1003225.aspx</link><pubDate>Thu, 28 Jul 2005 20:26:01 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1003225</guid><dc:creator>DarrellNorton</dc:creator><author>DarrellNorton</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1003225.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=54&amp;PostID=1003225</wfw:commentRss><description>That just shows there's more than one way to do it!&amp;nbsp; &lt;img src="/emoticons/emotion-1.gif" alt="Smile [:)]" /&gt;&lt;br&gt;</description></item><item><title>Re: Cannot open database requested in login 'dbName'. Login fails. Login failed for user 'machineName\ASPNET'</title><link>http://forums.asp.net/thread/1001664.aspx</link><pubDate>Wed, 27 Jul 2005 18:35:22 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1001664</guid><dc:creator>tmorton</dc:creator><author>tmorton</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1001664.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=54&amp;PostID=1001664</wfw:commentRss><description>You need to grant login permissions to the ASPNET account as well as
database permissions.&amp;nbsp; Do you have Enterprise Manager?&amp;nbsp; This
would help you to set permissions using a GUI tool.&amp;nbsp; Assuming you
do not, then you could use the osql commandline utility.&amp;nbsp; I am
also further assuming this is a local instance of SQL Server.&lt;br&gt;
&lt;br&gt;
&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;Using
osql, from the command prompt, this will connect you to your instance
of SQL Server and put you into an interactive mode with osql:
&lt;br&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;blockquote&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;pre&gt;osql -E -S (local)&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;
  &lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;Now you can enter the commands in the interactive mode:
&lt;br&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;blockquote&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;pre&gt;1&amp;gt;EXEC sp_grantlogin 'machineName\ASPNET'  &lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;
  &lt;pre&gt;2&amp;gt;GO&lt;/pre&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;
  &lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;
  &lt;pre&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;pre&gt;1&amp;gt;USE yourDatabase  &lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;
  &lt;pre&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;pre&gt;2&amp;gt;GO&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;
  &lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;
  &lt;pre&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;/span&gt;&lt;/span&gt;1&amp;gt;EXEC sp_grantdbaccess 'machineName\ASPNET'  &lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;
  &lt;pre&gt;2&amp;gt;GO&lt;br&gt;  &lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;
  
  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;&lt;span id="_ctl0__ctl0_BodyContentRegion_PostFlatView"&gt;
  &lt;pre&gt;1&amp;gt;EXIT&lt;/pre&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;font color="#ff0000"&gt;Edit: sorry, didn't see Darrell's post :-)&lt;/font&gt;&lt;br&gt;</description></item><item><title>Re: Cannot open database requested in login 'dbName'. Login fails. Login failed for user 'machineName\ASPNET'</title><link>http://forums.asp.net/thread/1001661.aspx</link><pubDate>Wed, 27 Jul 2005 18:34:02 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1001661</guid><dc:creator>DarrellNorton</dc:creator><author>DarrellNorton</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1001661.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=54&amp;PostID=1001661</wfw:commentRss><description>osql -E -S &lt;i&gt;InstanceName&lt;/i&gt; -C -Q "sp_grantlogin '&lt;i&gt;computer&lt;/i&gt;\ASPNET'" &lt;br&gt;osql -E -S &lt;i&gt;InstanceName&lt;/i&gt; -d &lt;i&gt;database&lt;/i&gt; -Q "sp_grantdbaccess '&lt;i&gt;computer&lt;/i&gt;\ASPNET'" &lt;br&gt;osql -E -S &lt;i&gt;Instance&lt;/i&gt;Name -d &lt;i&gt;database&lt;/i&gt; -Q "sp_addrolemember 'db_owner', '&lt;i&gt;computer&lt;/i&gt;\ASPNET'"&lt;i&gt;InstanceName&lt;/i&gt; -C -Q "sp_grantlogin '&lt;i&gt;computer&lt;/i&gt;\ASPNET'"&lt;br&gt;
&lt;br&gt;
InstanceName is optional if you only installed the default instance.&lt;br&gt;</description></item><item><title>Cannot open database requested in login 'dbName'. Login fails. Login failed for user 'machineName\ASPNET'</title><link>http://forums.asp.net/thread/1001573.aspx</link><pubDate>Wed, 27 Jul 2005 17:44:01 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1001573</guid><dc:creator>MEight</dc:creator><author>MEight</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1001573.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=54&amp;PostID=1001573</wfw:commentRss><description>&lt;P&gt;Been looking through the forums for a solution to this problem.&lt;BR&gt;&lt;BR&gt;I already tried granting access through statements such as:&lt;BR&gt;&lt;BR&gt;exec sp_grantloginaccess N1'machineName\ASPNET'&lt;BR&gt;&lt;BR&gt;But they don't seem to work.. i vaguely remember seeing somewhere a DOS command line statement that grants access to the ASPNET_WP and that fixed my problem before on another computer.. but this is a new computer and i forgot to write down the command.&lt;BR&gt;&lt;BR&gt;Can anyone help explain and propose a solution to my problem. Many thanxs.&lt;/P&gt;</description></item></channel></rss>