在VB.NET中添加新内容? [英] Addnew in VB.NET ?
问题描述
在VB6中,在recorset中添加新记录,可以使用Addnew方法,然后设置每个列的值,然后调用Update方法。
如何在VB.NET中执行此操作?
谢谢。
VB6:
私有m_rs作为新的ADODB .Recordset
m_rs.Open" SELECT * FROM myTable",adoCon,adOpenKeyset,adLockOptimistic
with m_rs
.AddNew
.Fields(" ip")= AccountIP& " " ''x.Address
.Fields(" account")= Account& " " ''左$(x.Key,5)
.Fields(" DATEtime")= Now& "
.Fields(" name")= userver& "
。更新
结束
In VB6 to add a new record in a recorset, you can use the Addnew method,
then set each column''s value, then call the Update method.
How can I do this in VB.NET ?
Thank you.
VB6:
Private m_rs As new ADODB.Recordset
m_rs.Open "SELECT * FROM myTable", adoCon, adOpenKeyset, adLockOptimistic
with m_rs
.AddNew
.Fields("ip") = AccountIP & " " '' x.Address
.Fields("account") = Account & " " ''Left$(x.Key, 5)
.Fields("DATEtime") = Now & " "
.Fields("name") = userver & " "
.Update
end with
推荐答案
(x.Key,5)
.Fields(" DATEtime")= Now& "
.Fields(" name")= userver& "
。更新
结束
(x.Key, 5)
.Fields("DATEtime") = Now & " "
.Fields("name") = userver & " "
.Update
end with
fniles,
几乎和我4小时前回答JNTP一样。
要在表格中添加新内容,您可以使用新方法。
http://msdn2.microsoft.com/ en-us / lib ... le.newrow.aspx
(如何操作示例位于VB.Net部分底部的此页面) 。
除此之外还存在dataview.newrow。
http://msdn2.microsoft.com/en-us/lib...ew.addnew.aspx
Cor
" fniles" < fn **** @ pfmail.comschreef在bericht
新闻:%2 **************** @ TK2MSFTNGP02.phx.gbl ...
fniles,
Almost the same as I have answered this 4 hours ago to JNTP.
To add a newrow to a table you can use in your case the newrow method.
http://msdn2.microsoft.com/en-us/lib...le.newrow.aspx
(a sample how to do it is at this page at the bottom of the VB.Net part).
Beside that exist too the dataview.newrow.
http://msdn2.microsoft.com/en-us/lib...ew.addnew.aspx
Cor
"fniles" <fn****@pfmail.comschreef in bericht
news:%2****************@TK2MSFTNGP02.phx.gbl...
在VB6中,在recorset中添加新记录,你可以使用Addnew方法,
然后设置每列的值,然后调用Update方法。
如何在VB.NET中执行此操作?
谢谢。
VB6:
私有m_rs作为新的ADODB.Recordset
m_rs.OpenSELECT * FROM myTable,adoCon,adOpenKeyset,adLockOptimistic
与m_rs
.AddNew
.Fields(" ip")= AccountIP& " " ''x.Address
.Fields(" account")= Account& " " ''左
In VB6 to add a new record in a recorset, you can use the Addnew method,
then set each column''s value, then call the Update method.
How can I do this in VB.NET ?
Thank you.
VB6:
Private m_rs As new ADODB.Recordset
m_rs.Open "SELECT * FROM myTable", adoCon, adOpenKeyset, adLockOptimistic
with m_rs
.AddNew
.Fields("ip") = AccountIP & " " '' x.Address
.Fields("account") = Account & " " ''Left
(x.Key,5)
.Fields(" DATEtime")= Now& "
.Fields(" name")= userver& "
。更新
结束
(x.Key, 5)
.Fields("DATEtime") = Now & " "
.Fields("name") = userver & " "
.Update
end with
这篇关于在VB.NET中添加新内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!