Last post Oct 25, 2008 01:56 PM by hans_v
Oct 24, 2008 02:05 PM|srameh|LINK
Thanks in advance for your advise.
Oct 24, 2008 05:43 PM|Mikesdotnetting|LINK
You can connect to the flat file directly with the Jet Provider. Or do you want to import the file contents into Access?
Oct 25, 2008 10:30 AM|srameh|LINK
Thanks for the reply. I am not allowed to connect to the Flat file as it contains sensitive data. So they have connected to the Flat file using Access and brought in some tables that does not contain sensitive data and created. The views are created on those
tables. I need to connect to those views and get the data that way.
Oct 25, 2008 11:52 AM|Mikesdotnetting|LINK
If they have created Views (saved queries) you can treat those in the same way as a Stored Procedure in SQL Server:
string SQL = "name_of_saved_query";
OleDbCommand cmd = new OleDbCommand(SQL, conn);
cmd.CommandType = CommandType.StoredProcedure;
Oct 25, 2008 01:00 PM|srameh|LINK
So Mike, you are saying that I can connect to this MS Access DB and treat those Views as same way we treat SP in SQL Server? My problem is not reading data from the database I have done that many many times with different databases but I have never connected
to a MS-Access DB which reads its data from a Flat file. So if I connect to this MS-Access DB and see those views (these views are created in the MS Access not in Flat Files) then I am all good. I could test this myself and find out how it works, but I don't
have the Flat File data in my development environment. So I was wondering if anyone has done it before.
Thanks for you help Mike
Oct 25, 2008 01:56 PM|hans_v|LINK
Like Mike Says, this can be done. Why don't try it youself? Create a csv file with some test data, link it in access, and you'll see that you can read the data just like a normal table, or you can make a query (view if you like) based on those file(s)
But you say that the views are created in access, not in the flat files. Does this mean that the files are linked, and the views are made in access. If that's the case, if you've the right to view the data in the viewsy, you'll also have the right to view
the data in the underlying (linked) tables. And if I understand you correctly, you're not allowed to view the entire table...
If that's the case, the solution is that they provide a flat file with only the data that you're allowed to see, and link this file to the access database. In fact, you don't even have to link it in an access database, you could connect to the file directly
using the techique that Mike as given you in his first reply