CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: update problem

  1. #1
    Join Date
    Feb 2009
    Posts
    3

    update problem

    I am using following code to update Access 2000 table. It executes the query but database is not updated and no error is generated. any body can help?


    Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
    Dim varGroupId As Integer
    Dim str As String
    cn1 = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App_Path() & "\client.mdb;")
    cn1.Open()
    varGroupId = dgvGroup("clmGroupId", dgvGroup.CurrentRow.Index).Value
    str = "Update GroupMaster set [GroupName]='" & txtGroupName.Text & "' WHERE [GroupID]=" & varGroupId
    cmd1 = New OleDbCommand(str, cn1)
    dr1 = cmd1.ExecuteNonQuery()
    MsgBox(dr1)
    cn1.Close()
    cmd1.Dispose()
    End Sub

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: update problem

    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Feb 2009
    Posts
    3

    Re: update problem

    Yes, This query is working in Access 2000.
    Last edited by sanjeev111; February 15th, 2009 at 05:15 AM.

  4. #4
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: update problem

    Paste it here, The query that WORKS in Access (with all values)
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  5. #5
    Join Date
    Feb 2009
    Posts
    3

    Re: update problem

    Query that worked in Access 2000 is

    UPDATE GroupMaster SET GroupName = 'san' WHERE GroupID=2;

    Table structure is:

    GroupID Number
    GroupName Text Required Yes AllowZeroLength No
    Remark Memo
    ParentGroupID Number

  6. #6
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: update problem

    Could it be the log in info? I don't user a user or password... perhaps getting read only access?

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

Featured