日期:2014-05-20  浏览次数:20967 次

异常详细信息: System.Data.OleDb.OleDbException: 表 'table_user' 已存在。
    string conn= "Provider=Microsoft.Jet.OLEDB.4.0;";
        conn+=@"Data Source=D:\my.mdb";
        OleDbConnection myconnection = new OleDbConnection(conn);
        myconnection.Open();
        String sql_create_table_user = "create table table_user(userName text,userPwd text,userRole int)"; 
        OleDbCommand command = new OleDbCommand();
        command.Connection = myconnection;
        command.CommandText = sql_create_table_user;
        command.ExecuteNonQuery();

        String sql_create_table_role = "create table table_role(roleId int,roleName text)";
        command.Connection = myconnection;
        command.CommandText = sql_create_table_role;
        command.ExecuteNonQuery();






“/WebSite2”应用程序中的服务器错误。

表 'table_user' 已存在。

说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 

异常详细信息: System.Data.OleDb.OleDbException: 表 'table_user' 已存在。

源错误: 


行 29:         command.Connection = myconnection;
行 30:         command.CommandText = sql_create_table_user;
行 31:         command.ExecuteNonQuery();
行 32: 
行 33:         String sql_create_table_role = "create table table_role(roleId int,roleName text)";

源文件: d:\My Documents\Visual Studio 2008\WebSites\WebSite2\register.aspx.cs    行: 31 

------最佳解决方案--------------------
这个有什么好解释的吗?已经提醒得再清楚不过了,table_user表已经存在在库中了。你再Create当然不行
------其他解决方案--------------------
好好学习  天天向上
------其他解决方案--------------------
这个错误信息已经详细的没法再详细了,仔细看看就会明白的.
------其他解决方案--------------------
同意楼上的说法,刷新一下应该就可以看到表了
------其他解决方案--------------------
数据库表已经存在了

你在创建之前 可以点drop table  tablename

删除了在创建 

试试
------其他解决方案--------------------

错误提示很清楚。。这个表己存在了。。



创建表时。。先删除原有叫这个名字的表
------其他解决方案--------------------
额。。。真的没什么解释的  见楼上诸位
------其他解决方案--------------------
这个错误的意思是你找到你的数据库把表 'table_user'删除后再执行