我试图把这个SQL例如命令转换为C#SqlCommand
:C#的SqlCommand语法SQL命令
if not exists (select column_name
from INFORMATION_SCHEMA.columns
where table_name = 'TotalHeals'
and column_name = '"+Healee+"')
alter table TotalHeals add +Healee+ int
我至今
// TO DO check to see if column exists instead of throwing error
cmd2 = new SqlCommand("ALTER TABLE TotalHeals ADD " + Healee + " INT",openCon);
cmd2.ExecuteNonQuery();
我完全失去如何编码if not exists语句。任何帮助?
我动态在飞行中添加列,并且不希望只捕获异常时,列已经存在 –