INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Visual Studio VB App with SQL Server 'Local' .mdf

Visual Studio VB App with SQL Server 'Local' .mdf

(OP)
Windows 7
MS Visual Studio Community 2015
MS SQL Server 2014
50 year old bloke - stuck in my old ways.

I have lot's of experience with MS Access VBA etc, but have a requirement to learn Visual Studio VB (or C#) connecting to 'local' (SQL Server) .mdf (file based tables).
It seems that 'local' (.mdf) databases aren't too prevalent (judging from my search results - or lack of them).
I've arrived at this solution requirement after much research and due to these attributes / limitations / tools available:

1) The compiled VS application can be packaged / deployed with 'file based' table definitions as opposed to SQL Server database tables (pretty much self-contained - apart from requiring a SQL Server instance).
2) These 'file based' tables can be handled by a SQL Server instance (without any objects having to be defined within SQL Server itself).
3) The SQL Server application is used for another, completely separate application, but, we have admin rights to it, thus can authorise user access to 'instances'.
4) To be clear: the .mdf's are LOCAL, FILE-BASED objects - with data-manipulation handled by calls via a SQL Server instance.
5) The reason we can't simply create tables, views, etc in SQL Server itself, is that it is 'ring-fenced' for one, specific application (although we can use the 'engine' as long as we don't store anything in there).
6) This SQL Server instance control of a 'local database' IS the optimum solution - I'll forget the project rather than use another 'flat-file' MySQL solution etc. (I have very high 'security' limitations, accompanied by the usual, extremely bureaucratic hurdles).

Learning problem:
I'm used to creating 'querydefs' (dynamic queries) and executing them in MS Access VBA. E.g. (SET rst = db.openrecordset("SELECT * FROM tableX")).
All examples found seem to insist on SQL Server table connection etc. (Which may be the same syntax-ish for local tables, but, I need a clear example).
Can anyone point me to a code example of creating a dynamic query at run time (much like the MS Access VBA 'querydef'), and connecting to the above .mdf 'local' database type, using VB or C#?
(I'm sure that it MUST exist, and one single example will put me on a path to discovering everything else that I need to learn).

Any pointers much appreciated, in the mean-time - I'll continue to Google.

Darrylle winky smile

P.S. Instead of making it look like this thread has had an answer (by adding a reply), I'll add any progress within the question (for now). I have come across this: https://support.microsoft.com/en-gb/help/308055/ho... which 'seems' to offer a possible example. I'll see winky smile

RE: Visual Studio VB App with SQL Server 'Local' .mdf

This is an old thread so i doubt it is an issue any longer. I just hate to see it go unanswered.





Simi

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close