在C#中根据用户提供的表名在某数据库中创建这个表,然后向表中写数据
关键是,怎么判断用户提供的表名是不是已经存在于数据库中呢?

解决方案 »

  1.   

    if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[表名]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
        print 'yes'
    else
        print 'no'
      

  2.   

    if object_id('你的表名') is null
    create table...
      

  3.   

    写SQL语句,根据用户输入的表名,查询数据库中是否存在这张表。
      

  4.   

    if object_id('[table]') is not null select 'table is exsisted' else select 'table isnt existed'
      

  5.   

    我要在c#中进行判断,难道要打开SQL去写SQL语句么?
      

  6.   

    直接查询该数据库,try catch下,报错就是没有
      

  7.   

    就是在C#里面写SQL语句 通过ADO连接数据库进行查询。。