请各位大侠给出用VB.NET连接oracle数据库并执行sql查询语句的代码示例,谢谢!!
展开全部
Dim OraSession As Object '会话对象
Dim OraDatabase As Object '数据库对象
Dim OraDynaset As Object'动态集对象
Dim OraDatabase As Object’字段集对象
Set OraSession =CreateObject("OracleInProcServer.XOraSession")
Set OraDatabase=OraSession.CreateDatabase
("Demo","scott/tiger",0&)'建立数据库连接
Set OraDynaset=OraDatabase.CreateDynaset("select*from
student",0&)'初始化动态集对象
’添加记录
'Begin an AddNew
OraDynaset.DbAddNew
OraDynaset.Fields("ID").value="1000"
’ID为列名
OraDynaset.DbUpdate'更新数据到表
’删除
OraDynaset.DbDelete
'修改
OraDynaset.DbEdit
OraDynaset.Fields("ID").value="101210"
OraDynaset.DbUpdate
Dim OraDatabase As Object '数据库对象
Dim OraDynaset As Object'动态集对象
Dim OraDatabase As Object’字段集对象
Set OraSession =CreateObject("OracleInProcServer.XOraSession")
Set OraDatabase=OraSession.CreateDatabase
("Demo","scott/tiger",0&)'建立数据库连接
Set OraDynaset=OraDatabase.CreateDynaset("select*from
student",0&)'初始化动态集对象
’添加记录
'Begin an AddNew
OraDynaset.DbAddNew
OraDynaset.Fields("ID").value="1000"
’ID为列名
OraDynaset.DbUpdate'更新数据到表
’删除
OraDynaset.DbDelete
'修改
OraDynaset.DbEdit
OraDynaset.Fields("ID").value="101210"
OraDynaset.DbUpdate
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |