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?
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:
Public Function UniversalQuery(ByVal tablename As String,ByVal cn as Sqlconnection) As SqlDataReader
Dim dr As SqlDataReader
Dim cm As New SqlCommand("select * from " & tablename & "",cn)
dr = cm.ExecuteReader
Return dr
End Function