我用ADO和dataGrid控件绑定来获取SQL Server里的数据,现在我要添加记录到数据表里去,代码如下Adodc1.RecordSource = "select * from authors"
Adodc1.Refresh
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("au_id").Value = Text1.Text
Adodc1.Recordset.Update
Adodc1.Refresh
但老是报错说ODBC SQL Server 不能将NULL值加入,我调试发现
Adodc1.Recordset.Fields("au_id").Value = Text1.Text
语句有值,值为Text框里写入的数据