Last post Nov 20, 2014 03:25 AM by Mikesdotnetting
Nov 19, 2014 11:40 PM|hkbeer|LINK
I have a mdb file and using Visual Web/VS2010
I need to create a new query in mdb file.
So I use VW2010 database Explorer to browse my mdb
It shows Table1 properly with fields ID, Country, Sales.
I need to add a query in this mdb Select Country, Sales from Table1.
So I right click View folder, Select "New Query"
Then in db diagram and check the boxes vs Country and Sales. SQL is good.
So far no problem up till now.
However, there is no way for me to save this query into mdb. Even I click Save all button, there is no new VIEW/query added to mdb file.
Anyone knows what I should do ? Thanks
Nov 20, 2014 03:25 AM|Mikesdotnetting|LINK
Visual Studio doesn't provide the tools for creating saved queries in mdb files. You can either open the file with Access and create the saved query, or you can use Data Definition Language (DDL) from code to create a saved query:
Dim ddl = "CREATE PROCEDURE GetSales AS SELECT Country, Sales FROM Table1"
Using conn As New OleDbConnection(yourConnectionString)
Using cmd As New OleDbCommand(ddl, conn)