# datagrid新增资料

Posted by alec on October 04, 1999 at 16:42:47:

我将datagrid连接到sql7.0资料库,按新增按钮时可在datagrid中输入资料
不知为何不能新增,程式码如下,请各位新知帮我解答一下
Dim wid, wname As String
Dim wcredit, wamt As Integer
Adodc1.Recordset.AddNew
DataGrid1.Row = DataGrid1.Row + 1
DataGrid1.Refresh
DataGrid1.SetFocus
rs.MoveLast
wid = DataGrid1.Columns(0).Value
wname = DataGrid1.Columns(1).Value
wcredit = DataGrid1.Columns(2).Value
wamt = DataGrid1.Columns(3).Value
rs("spec_id").Value = wid

rs("spec_name").Value = wname
rs("spec_credit").Value = wcredit
rs("use_credit").Value = wamt

Follow Ups: