Results 1 to 2 of 2
  1. #1
    kbsudhir is offline Novice
    Windows Vista Access 2003
    Join Date
    Apr 2009
    Posts
    10

    Exclamation Pass Parameters to Access Query from VB.net

    Hi All,

    I am trying to pass execute a Access Query with parameters from VB.Net. It is not extracting any data from the tables nor throwing any errors. I am not able to understand where am I going wrong. Below is my code snippets.

    Code:
    
    Private Sub ClientNamecbox_SelectedIndexChanged(ByVal sender As Object, _
            ByVal e As System.EventArgs) Handles ClientNamecbox.SelectedIndexChanged
    
    
    
            Dim ParamValue As String = ""
            Dim con As OleDbConnection = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\Docs\Tracker.accdb;")
            Dim cmd As New OleDbCommand
            cmd.CommandType = CommandType.StoredProcedure
            cmd.CommandText = "GetPursuit"
    
    
    
    
    
            cmd.Parameters.Add("Name", OleDbType.VarWChar).Value = Namecbox.SelectedValue ' Add Parameter
            cmd.Connection = con
    
    
    
    
            Dim da As OleDbDataAdapter = New OleDbDataAdapter(cmd)
            con.Open()
    
    
            Dim ds As DataSet = New DataSet()
            da.Fill(ds, "Tracker")
    
    
    
            PNamecbox.ValueMember = ""
            PNamecbox.DataSource = ds.Tables("Tracker")
            PNamecbox.DisplayMember = "PName"
            PNamecbox.ValueMember = "PName"
    
    
            con.Close()
    
    
      End Sub
    
    


    Please guide.

    Thanks in advance.

    Regards
    Sudhir


  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,921
    You are trying to use VB.Net to modify a query saved in Access file? So this is a VB.Net issue? Might try a .Net forum http://forums.aspfree.com/net-development-11/
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 10-04-2013, 02:52 PM
  2. Pass parameters
    By BFlat in forum Queries
    Replies: 15
    Last Post: 04-03-2012, 07:27 AM
  3. Pass parameters to a query from a form
    By zipmaster07 in forum Queries
    Replies: 1
    Last Post: 02-21-2012, 02:19 PM
  4. Replies: 8
    Last Post: 12-21-2011, 12:50 PM
  5. Pass command line parameters
    By lanto3000 in forum Access
    Replies: 2
    Last Post: 03-21-2010, 03:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums