我想填写一些文字并在c#中删除一些文字 [英] i want fill some text and take some text blank in c#

查看:97
本文介绍了我想填写一些文字并在c#中删除一些文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的先生/女士,





如果我想保存记录,那段时间我没有填写所有记录意味着留下一些空白字段并保存此记录。我可以在c#(Windows应用程序)中使用SQL 2005编写哪些代码。

Dear Sir/Madam,


If i want to save record and that time i am not fill all records means leave some blank field and save this record.what code i can write in c#(Windows application) uing SQL 2005.

推荐答案

这取决于表模式。您不能将没有默认值或自动生成值的字段留空,但是不能使用空约束。



It depends on the table schema. You can not leave fields blank that have no default or autogenerated value, but have a not null constraint.

CREATE TABLE #tmp(
  id INT NOT NULL identity(1,1),
  now DATETIME NOT NULL CONSTRAINT DF_MyTable_CreateDate_GETDATE DEFAULT GETDATE(),
  name varchar(100) not null,
  address varchar(100)
)

insert into #tmp(now, name, address) values('2013.01.01 10:25:00', 'John', 'Paris'); 
insert into #tmp(name, address) values('Peter', 'Berlin');
insert into #tmp(name) values('Bianca');
insert into #tmp(address) values('Bratislava'); -- will fail

select * from #tmp;

DROP TABLE #tmp





从这里开始,一切正常ADO.NET:使用C#读取,插入,更新和删除简单的ADO.NET数据库。 [ ^ ]


这篇关于我想填写一些文字并在c#中删除一些文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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