数据库中已存在名为“tableName”的对象 [英] There is already an object named 'tableName' in the database

查看:827
本文介绍了数据库中已存在名为“tableName”的对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

数据库中已经有一个名为'tableName'的对象



i正在使用wpf应用程序,我想创建数据库实体框架,我接受这个错误。表中出现此错误..



'数据库中已有一个名为'## tbl'的对象'



我在我的wpf应用程序中使用了2个dll

1. Microsoft.Kinect

2.Microsoft.Kinect.Wpf.Controls




如果我删除这2个dll并运行新数据库的应用程序,那么一切都很顺利..



谷歌搜索很多但没有发现任何东西,为什么包含这两个dll超过异常...



真的很沮丧......请...

There is already an object named 'tableName' in the database

i am working with wpf application and i want to create database with entity framework, i take this error. This error appears for table..

'There is already an object named '##tbl' in the database'

i have used 2 dll's in my wpf application
1. Microsoft.Kinect
2. Microsoft.Kinect.Wpf.Controls


if i remove this 2 dlls and run application for fresh database, then everything is going fine..

googled lot but found nothing, why on inclusion of those two dlls getting above exception..

really frustrated... Pls...

推荐答案

我真的相信你自己提供了问题的答案。这里的问题是你的数据库' tableName '内部已经存在,你正在尝试重新创建。这反过来会在逻辑中产生错误并给你这个错误。



I really believe that you have yourself provided the answer to your problem. The problem here is that inside your database 'tableName' is already present that you're trying to recreate. Which in turn creates an error in the logic and gives you this error.

引用:

如果我删除这2个dll并运行新数据库,然后一切都很顺利..

if i remove this 2 dlls and run application for fresh database, then everything is going fine..





现在数据库是新版本,这意味着没有表格使用该名称,因此它创建并且代码正常。



我想建议你在尝试创建这个表或对象时,必须添加一个新的 if else 仅当数据库中没有表时才阻止创建此表。如果有表,则必须跳过此行。



Now when the database is a fresh version, that means there is no table with that name so it creates and the code goes fine.

I would like to make an advise that where ever you're trying to create this table or object, you must add a new if else block to create this table only if there is no table in the database. If there is a table, then it must skip this line.


这篇关于数据库中已存在名为“tableName”的对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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