[已关闭问题]
<P><FONT size=2> 其实现在软件或web应用程序好多都要sql server, 本来对程序员用企业管理器就可以附加进去 昨天晚上闲着也是闲着,做了个web版的附加器 不对地方请大家多批教!<BR><IMG class="" onmouseover="return true;this.src='http://accpxcb.cnblogs.com';" title="WEB版的SQL server附加器" height=247 alt="WEB版的SQL server附加器" src="http://www.cnblogs.com/images/cnblogs_com/accpxcb/108272/r_sqlAppend.jpg" width=308 mce_src="http://www.cnblogs.com/images/cnblogs_com/accpxcb/108272/r_sqlAppend.jpg"></FONT></P>
问题补充:
using System;
2using System.Data;
3using System.Configuration;
4using System.Web;
5using System.Web.Security;
6using System.Web.UI;
7using System.Web.UI.WebControls;
8using System.Web.UI.WebControls.WebParts;
9using System.Web.UI.HtmlControls;
10using System.Data.SqlClient;
11using System.IO;
12public partial class _Default : System.Web.UI.Page
13{
14 public string sqlServer;
15 public string uid;
16 public string pwd;
17 public string sqlstr;
18 protected void Page_Load(object sender, EventArgs e)
19 {
20
21 }
22 protected void btnStup_Click(object sender, EventArgs e)
23 {
24 string fileExtend = Path.GetExtension(File_MDF.PostedFile.FileName);//获取扩展名
25 string file_Name = Path.GetFileName(File_MDF.PostedFile.FileName); //获取文件名
26
27 if (fileExtend.ToUpper().CompareTo(".MDF") == 0)
28 {
29 // Response.Write(fileExtend.ToString()+"<br>名:"+file_Name.ToString()+"<br>"+File_MDF.Value);
30 string fileName=file_Name.Substring(0,file_Name.LastIndexOf("_",file_Name.Length));//得到正确名称
31 string logname = File_MDF.Value.Substring(0, File_MDF.Value.LastIndexOf("_",File_MDF.Value.Length)) + "_Log.LDF";
32 string logname1 = File_MDF.Value.Substring(0, File_MDF.Value.LastIndexOf("_",File_MDF.Value.Length)) + "_log.ldf";
33 if (File.Exists(logname)||File.Exists(logname1))
34 {
35 if (rdosql.Checked)
36 {
37 sqlServer = "server=" + txtServer.Text + ";User id=" + txtuid.Text + ";Pwd=" + txtpwd.Text + "";
38 }
39 else
40 {
41 sqlServer = "server=" + txtServer.Text + ";uid="+uid+"";
42 }
43 SqlCo