数据库创建与允许 [英] Database Creation & permission

查看:68
本文介绍了数据库创建与允许的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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;// Error here :: you don't have permission to open this file.


            }
        }



我创建了一个以编程方式创建数据库的应用程序,并在其中使用了一个Dialog(OpenFileDialog类).
供用户选择我上面提到的数据库.
现在,当用户要打开它(创建的* .mdf文件)时,它说<<您无权打开此文件.>>
我用于数据库创建的代码是:



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%)



我应该如何更改代码以获取用户许可?还是我最好做些什么?gimme解决方案...



How should I change the code to get permission to the user ? or what I must better do ?gimme Solution...

推荐答案

请参见此KB
http://msdn.microsoft.com/en-us/library/ms178569.aspx [ ^ ]

:thumbsup:
گفتارنیک-پندارنیک-کردارنیک
see this KB
http://msdn.microsoft.com/en-us/library/ms178569.aspx[^]

:thumbsup:
گفتار نیک - پندار نیک - کردار نیک


这篇关于数据库创建与允许的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆