Results 1 to 12 of 12

Thread: Add command from sql server

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2015
    Posts
    102

    Add command from sql server

    Hello,
    Am trying use command from SQL server on my vb.net by press button.

    command
    Code:
    DBCC DROPCLEANBUFFERS
    am getting error
    Code:
     Private Sub Button168_Click(sender As Object, e As EventArgs) Handles Button168.Click
            Dim sql = <sql>
               DBCC DROPCLEANBUFFERS
              </sql>
            Using connection As New SqlConnection("Data Source=ABOAHMED\SQLEXPRESS;Initial Catalog=kankon;Persist Security Info=True;User ID=aboahmed;Password=12345;MultipleActiveResultSets=True"),
                  command As New SqlCommand(sql.Value, connection)
                connection.Open()
                command.ExecuteNonQuery()
            End Using
        End Sub

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: Add command from sql server

    Quote Originally Posted by kankon View Post
    am getting error
    If only there were some way for us to know more about that, like the error message.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2015
    Posts
    102

    Re: Add command from sql server

    Quote Originally Posted by jmcilhinney View Post
    If only there were some way for us to know more about that, like the error message.
    ok ?

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: Add command from sql server

    Wow. You are looking at the error message yourself. You need to post it here so we know what it is. We shouldn't have to guess anything that you already know.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Feb 2015
    Posts
    102

    Re: Add command from sql server

    Quote Originally Posted by jmcilhinney View Post
    Wow. You are looking at the error message yourself. You need to post it here so we know what it is. We shouldn't have to guess anything that you already know.
    sorry did not upload the image,
    also am using the second pc the first pc with db
    also i add permission db_ddladmin and the db_owner
    Attached Images Attached Images  

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: Add command from sql server

    So this question literally has nothing to do with VB.NET. It's a SQL Server permissions issue so that's what you need to be looking into. Have you checked what permissions are required to execute that command?

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Feb 2015
    Posts
    102

    Re: Add command from sql server

    Quote Originally Posted by jmcilhinney View Post
    So this question literally has nothing to do with VB.NET. It's a SQL Server permissions issue so that's what you need to be looking into. Have you checked what permissions are required to execute that command?
    well , its work now just with first pc with db , my second pc not working :\

  8. #8
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,929

    Re: Add command from sql server

    Thread moved to the 'Database Development' forum

    Does it work on the first pc for the same user? (User ID=aboahmed;Password=12345)

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Feb 2015
    Posts
    102

    Re: Add command from sql server

    Quote Originally Posted by si_the_geek View Post
    Thread moved to the 'Database Development' forum

    Does it work on the first pc for the same user? (User ID=aboahmed;Password=12345)
    with first pc work very well
    second pc i can connect by sql server by user and pass : but the command not work by sql server or my app vb.net

  10. #10
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,929

    Re: Add command from sql server

    Quote Originally Posted by kankon View Post
    with first pc work very well
    Is that with the same login details?

  11. #11

    Thread Starter
    Lively Member
    Join Date
    Feb 2015
    Posts
    102

    Re: Add command from sql server

    Yes it’s same
    Quote Originally Posted by si_the_geek View Post
    Is that with the same login details?

  12. #12
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,834

    Re: Add command from sql server

    Quote Originally Posted by si_the_geek View Post
    Thread moved to the 'Database Development' forum

    Does it work on the first pc for the same user? (User ID=aboahmed;Password=12345)
    Spaceballs
    Attached Images Attached Images  
    Please remember next time...elections matter!

Posting Permissions

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



Click Here to Expand Forum to Full Width