I have a C# program that uses the following code to compile stored procedures for later use.
private void createproc(string spName, System.Data.SqlClient.SqlConnection dataConnection)
{
SqlCommand dataCommand = new SqlCommand();
dataCommand.Connection = dataConnection;
string FILE_NAME = @"c:\Program Files\path\" + spName + ".sql";
StreamReader sr = File.OpenText(FILE_NAME);
String input;
String vinput;
vinput = " ";
while ((input=sr.ReadLine())!=null)
{
vinput += ('\n' + input);
}
sr.Close();
//compile procedure
dataCommand.CommandText = vinput;
SqlDataReader dataReader0 = dataCommand.ExecuteReader();
dataReader0.Close();
}
Right now I have the .sql files for each stored proc attached to the project as Project Output. So when I build, then run the msi file it puts the .sql files that I need on my C drive to be grabbed later to compile.
The question. Is there any way to embed these files. I don't really like it that a user will be able to see the .sql files after install on their C drive. But I need the files to be visible to the C# code to grab and compile.
I hope this makes some sense. Thank you!
private void createproc(string spName, System.Data.SqlClient.SqlConnection dataConnection)
{
SqlCommand dataCommand = new SqlCommand();
dataCommand.Connection = dataConnection;
string FILE_NAME = @"c:\Program Files\path\" + spName + ".sql";
StreamReader sr = File.OpenText(FILE_NAME);
String input;
String vinput;
vinput = " ";
while ((input=sr.ReadLine())!=null)
{
vinput += ('\n' + input);
}
sr.Close();
//compile procedure
dataCommand.CommandText = vinput;
SqlDataReader dataReader0 = dataCommand.ExecuteReader();
dataReader0.Close();
}
Right now I have the .sql files for each stored proc attached to the project as Project Output. So when I build, then run the msi file it puts the .sql files that I need on my C drive to be grabbed later to compile.
The question. Is there any way to embed these files. I don't really like it that a user will be able to see the .sql files after install on their C drive. But I need the files to be visible to the C# code to grab and compile.
I hope this makes some sense. Thank you!