private void OpenToolStripMenuItem_Click(object sender, EventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.Title = "database selection ";
dlg.Filter = "database file (*.mdf)|*.mdf";
dlg.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
if (dlg.ShowDialog() == DialogResult.OK)
{
label1.Text = dlg.FileName;
}
}
I create an appliction that create database programmatically, and I used a Dialog (OpenFileDialog class) in it;
for user to select the database which I mentioned above.
now when user want to open it(the *.mdf file that created ), it says <<you don't have permission to open this file.>>
my code for database creation is :
CREATE DATABASE TestDb
ON PRIMARY
(NAME = TestDb_Data, FILENAME = 'C:\TestDb_Data.mdf', SIZE = 2MB,FILEGROWTH =10%)
LOG ON
(NAME =TestDb_Log, FILENAME = 'C:\TestDb_Log.ldf', SIZE = 1MB, FILEGROWTH =10%)
How should I change the code to get permission to the user ? or what I must better do ?gimme Solution...