Solved

How to run sql script included in application

Posted on 2015-02-14
4
44 Views
Last Modified: 2015-02-14
I  have  four scripts  ,which I  use  to  deploy  along  with  my  exe  at  client  end.Scripts  use to create  database.
Now  it is  requirement  that,sepearate  script  files  should  not  be there.So  I  included  them  in  WPF  C#  application.
Now  I  have  to  give  path  of   them.How  can give  script  files  path  from  application.I  am  attaching  image  of  my  folder  structure.I  need  to  run script  from  project LumiQuant_ASW. Please  help
SQL-script.png
SQL-script2.png
0
Comment
Question by:ADITYA RAO
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
4 Comments
 

Accepted Solution

by:
ADITYA RAO earned 0 total points
ID: 40609579
I  moved  file  to LumiQuant_ASW and  in  I  appended  path
 String strpath = AppDomain.CurrentDomain.BaseDirectory;
It  worked  perfectly
0
 

Author Comment

by:ADITYA RAO
ID: 40609583
very  sorry  to  inform  this  solution  does  not  work. I  found  no  option  to  reopen  the  question.
Actually  solution  runned  once  because  by  mistake  script  files  where  present in  debug  folder.
The  main  question  how  to  use  files  in  application  and  not  on  physical  drive.Please  reopen
the question.
0
 

Author Comment

by:ADITYA RAO
ID: 40609629
Now I  found  perfect  solution  which  worked.
I  renamed  .sql files  to .txt
Added those  files in project.
right clicked  files and opened properites,set  build action to"Embeded Resources"


  Assembly _assembly;
  _assembly = Assembly.GetExecutingAssembly();
 _assembly.GetManifestResourceStream("PrjMerilDB.CREATEDB_ELISALUMI.txt")
0
 

Author Comment

by:ADITYA RAO
ID: 40609630
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

627 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