Results 1 to 2 of 2

Thread: Is it possible to create a universal query?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2005
    Posts
    210

    Is it possible to create a universal query?

    I'm currently doing a program that maintains several tables. I'm thinking instead of making a query procedure for each form for each table I will just program a "universal" query in a module and just have each form call that particular module whenever a query is run. The problem is the tables are different from each other in terms of the number of columns. Is there a way to do this?

  2. #2
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416

    Re: Is it possible to create a universal query?

    pass the name of your table to your query
    it is a method that returns an sqldatareader
    VB Code:
    1. Public Function UniversalQuery(ByVal tablename As String,ByVal cn as Sqlconnection) As SqlDataReader
    2.         Dim dr As SqlDataReader
    3.         Dim cm As New SqlCommand("select * from " & tablename & "",cn)
    4.         dr = cm.ExecuteReader
    5.         Return dr
    6.     End Function

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