SqlDataAdapter Error?

S

Sam

I using SqlDataAdapter and I encounter the error as shown as below. Please
assist and guide me on SQLDataAdapter for SQL Insert and Update.

Error Message
---------------
Compilation Error
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.

Compiler Error Message: BC30188: Declaration expected.

Source Error:


Line 14: Dim oDa As OleDbDataAdapter
Line 15:
Line 16: oConn = New OleDbConnection ("Provider=SQLOLEDB;Data
Source=KULSQL;Initial Catalog=Retire_Benefit;Persist Security Info=True;User
ID=intranet;Password=88")
Line 17: oConn.Open()
Line 18:

Source File: D:\SQLDB\Intranet\WebApp\RetireBenefit\subsystem\process.aspx
Line: 16


Coding
-------
<%@ Page Language="VB" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.OleDB" %>

<script language="VB" runat="server">

'Declare current month as integer
Dim MonthNum as New System.DateTime

Dim month As Integer = MonthNum.Month

Dim oConn As OleDbConnection
Dim oCmd As OleDbCommand
Dim oDa As OleDbDataAdapter

oConn = New OleDbConnection ("Provider=SQLOLEDB;Data
Source=KULSQL;Initial Catalog=Retire_Benefit;Persist Security Info=True;User
ID=intranet;Password=88")
oConn.Open()

oCmd = New OleDbCommand ("Select * from PeriodMonthNum", oConn)

oDa = New OleDbDataAdapter()
oDa.SelectCommand = oCmd

</script>
 
S

Sam

In ADO 2.0, I use the following coding for SQL Select but I encounter error
when I try to use ASP.Net.

Dim ConnSQL
Set ConnSQL = Server.CreateObject("ADODB.Connection")
ConnSQLStr = "Provider=SQLOLEDB.1;Password=88;Persist Security
Info=True;User ID=intranet;Initial Catalog=Retire_benefit;Data
Source=kulsql"
ConnSQL.Open ConnSQLStr

rs2statm = "Select * from PeriodMonthNum"
ConnSQL.Execute(rs2statm)
Set rs2statm = Nothing

How to convert it into ASP.Net ?
 
S

Sushil Chordia

Sam, The namespace for OleDb Managed Provider is System.Data.OleDb. Try
doing the following:
Before: <%@ import Namespace="System.Data.OleDB" %>
After: <%@ import Namespace="System.Data.OleDb" %>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top