oracle中dataadapter,如何从oracle.dataaccess.client.oracledataadapter填充system.data.dataset?

问候,

我在服务器上安装了Oracle 10g Express Edition数据库,并在我的PC上安装了客户端。

现在,I`m developing a vb.net application using visual studio 2005 and I need to use the oracle 10g express edition database. SO I initialize the connection using the following connection string:

_connectionString = "User Id=Graphya;Password=Graphya;Data Source=gis64:1522/XE;"Then I define new OracleDataAdapter, and I use the following code to fill a dataset:

Dim insertCommand As OracleCommand = New OracleCommand()

Dim commandTextTemplate As String = "INSERT INTO {0}(" & g_pfldUsername & ", " & g_pfldSubject & ") VALUES (?, ?)"

insertCommand.CommandText = String.Format(commandTextTemplate,TABLE_NAME)

insertCommand.Connection = Me.Connection

insertCommand.Parameters.Add(New Oracle.DataAccess.Client.OracleParameter(g_pfldUsername, Oracle.DataAccess.Client.OracleDbType.Varchar2, 50, g_pfldUsername))

insertCommand.Parameters.Add(New Oracle.DataAccess.Client.OracleParameter(g_pfldSubject, Oracle.DataAccess.Client.OracleDbType.Varchar2, 50, g_pfldSubject))

_OracleDataAdapter.InsertCommand = insertCommand

_OracleDataAdapter.Fill(_dataSet, TABLE_NAME)So after debugging this code I got the following error:

Unable to cast object of type 'Oracle.DataAccess.Client.OracleCommand' to type 'System.Data.Common.DbCommand'.

So I`m卡在这里,我需要一点帮助,请告知....

提前致谢..

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值