CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20

Thread: Access to MSSQLServer 2008 R2 but not rights

  1. #16
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,316

    Re: Access to MSSQLServer 2008 R2 but not rights

    If you can still programmatically connect to MyServerName\SQLEXPRESS, but don't see it in SQL mgmt studio, try enter MyServerName\SQLEXPRESS directly instead of attempting to select it from the drop down list.

  2. #17
    Join Date
    Aug 2015
    Posts
    59

    Re: Access to MSSQLServer 2008 R2 but not rights

    why you believe so hardly its about how to connect?

  3. #18
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,316

    Re: Access to MSSQLServer 2008 R2 but not rights

    Quote Originally Posted by pschulz View Post
    why you believe so hardly its about how to connect?
    It's pretty hard to tell what your issues are at this point. If you can describe clearly what you are trying to do and what problems you are having, please do so; otherwise, let the thread die.

  4. #19
    Join Date
    Sep 2016
    Location
    pune
    Posts
    7

    Re: Access to MSSQLServer 2008 R2 but not rights

    its good article that showes sql server run.
    Code:
                string strCnn = ("data source='" + strServerName + "';integrated security=SSPI");
                SqlConnection server = null;
    
                try
                {
                    server = new SqlConnection(strCnn);
                    server.Open();
                    return true;
                }
    
                catch (SqlException ex)
                {
                    //ClsMsg.message(ex.Message);
                    return false;
                }
    
                catch (Exception ex)
                {
                    //throw new Exception(ex.Message);
                    return false;
                }
    
                finally
                {
                    server.Close();
                    if (server is IDisposable)
                    {
                        (server as IDisposable).Dispose();
                    }
    
                    if ((server != null))
                        server = null;
                }
    Last edited by 2kaud; November 4th, 2016 at 03:32 AM.

  5. #20
    Join Date
    Aug 2015
    Posts
    59

    Re: Access to MSSQLServer 2008 R2 but not rights

    I would change "finally" like:
    Code:
    finally
                {               
                   if ((server != null))
                     {  server.Close();
                        if (server is IDisposable)
                        {
                        (server as IDisposable).Dispose();
                     }
                        server = null;
                   }
    but, it takes down the start subject

Page 2 of 2 FirstFirst 12

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)