南京农业大学住宿:ASP.NET编程问题
来源:百度文库 编辑:神马品牌网 时间:2024/10/03 03:43:47
我用C#来编辑的,数据库用的是ACCESS,表格的路径是E:\Inetpub\wwwroot\WebApplication1\db1.mdb,
但是在建插入的功能时,读不到路径指想的表格,我是这样弄的:
string str = "Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source=E:\Inetpub\wwwroot\WebApplication1\db1.mdb";
OdbcConnection con = new OdbcConnection(str);
con.Open();
string strInsert = " INSERT INTO 表1 value( "+this.TextBox1.Text+","+this.TextBox2.Text+","+this.TextBox3.Text+","+this.TextBox4.Text+")";
OdbcCommand inst = new OdbcCommand( strInsert , con ) ;
inst.ExecuteNonQuery();
con.Close();
请问哪里有错啊
但是在建插入的功能时,读不到路径指想的表格,我是这样弄的:
string str = "Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source=E:\Inetpub\wwwroot\WebApplication1\db1.mdb";
OdbcConnection con = new OdbcConnection(str);
con.Open();
string strInsert = " INSERT INTO 表1 value( "+this.TextBox1.Text+","+this.TextBox2.Text+","+this.TextBox3.Text+","+this.TextBox4.Text+")";
OdbcCommand inst = new OdbcCommand( strInsert , con ) ;
inst.ExecuteNonQuery();
con.Close();
请问哪里有错啊
捕捉下异常,看看是什么异常
使用相对路径