Solved

How to run sql script included in application

Posted on 2015-02-14
4
39 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:enthurao
  • 4
4 Comments
 

Accepted Solution

by:
enthurao 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:enthurao
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:enthurao
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:enthurao
ID: 40609630
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now