my won't visual studio recognize the standard connection code: adapter.fill(myDataset)

I am trying to setup a connection to a remote oracle db using OracleConnection in .NET 3.5 (I know it has been deprecated in later versions of .NET). Why won't Visual Studio recognize the statement myAdapter.fill(mydataset)

Imports System.Data.OracleClient //I compiled the project to .net 3.5. there is a warning for system.threading.tasks but not for system.data.oracleclient

Public Class Form1
Dim cString As String = "Data Source=usr/pw@host:1521/orcl"
Dim myCon As OracleConnection = New OracleConnection(cString)
Dim myAdapter As OracleDataAdapter = New OracleDataAdapter("select * from courses", cString)
Dim myDataSet As DataSet = New DataSet
myAdapter.fill(myDataset) //Declaration expected
//this strange behavior might be a clue ... Dim m as OracleDataReader = new OracleDataReader yields overload resolution failed because no new is accessible

Answers


You need to put .Fill in a function or subroutine. You cannot use code in the form definition unless it's used to initialize a member. I suspect you want something like:

Public Class Form1
Dim cString As String = "Data Source=usr/pw@host:1521/orcl"
Dim myCon As OracleConnection = New OracleConnection(cString)
Dim myAdapter As OracleDataAdapter = New OracleDataAdapter("select * from courses", cString)
Dim myDataSet As DataSet = New DataSet

Private Sub FillData()
    myAdapter.fill(myDataset) 
End Sub

and then call FillData from wherever it's appropriate.


Need Your Help

Generate self-signed ssl certificate as a part of maven build

java maven ssl-certificate keytool

there is a maven-keytool plugin that could be used to generate ssl certificate during the build, but it requires java 7 to generate it:

Passing multiple env files in docker run command

docker environment-variables env

I was just wondering how can i point to two env-files, say /var/app/old/file.conf and /var/market/old/db.conf , both in the command line as I find there is support for mutiple -e flags. Does Docker

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.