Solved

How to run sql script included in application

Posted on 2015-02-14
4
41 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
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…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

831 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