?
Solved

Create a stored query using oledb

Posted on 2006-04-19
1
Medium Priority
?
272 Views
Last Modified: 2008-02-26
Hi
I used the following syntax in vb.6
How do I perform this task using oledb in vb.net 2005

'############
private sub createQuery
Dim qdfNew     As QueryDef
 Dim SQL        As String
   
 On Error Resume Next

 SQL = "select * from QrySubRegData UNION ALL Select * from QrySubBeerData;"
 
 With db
   .QueryDefs.Delete "QryUnionResetBase"
   Set qdfNew = .CreateQueryDef("QryUnionResetBase", SQL)
 End With
end sub
0
Comment
Question by:visualbasic
1 Comment
 
LVL 96

Accepted Solution

by:
Bob Learned earned 200 total points
ID: 16489905
You cannot do that with ADO.NET, but you can always add a reference to DAO, and do it the old way:

Try

  db.QueryDefs.Delete("QryUnionResetBase")
  db.CreateQueryDef("", "SELECT * FROM QrySubRegData UNION ALL SELECT * from QrySubBeerData;"

Catch

End Try

Bob
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses
Course of the Month16 days, 23 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question