.Net Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - More.Net Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 28th, 2003, 08:45 AM
Pain Pain is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Sheffield, UK
Posts: 94 Pain User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to Pain
OleDbDataReaders

Excuse the code, but can anyone tell me why im getting these errors, and how I can fix them?

All im wanting to do is send a select query to a database, knowing that 3 columns of data will come back..

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click



Dim myReader As OleDbDataReader()

Dim myOleDbConnection As OleDbConnection

Dim myOleDbCommand As OleDbCommand



myOleDbCommand = New OleDbCommand("SELECT POPUP.P_TYPE, POPUP.P_TITLE, POPUP.P_MSG FROM [POPUP] WHERE POPUP.P_TYPE='normal' AND POPUP.PID = (SELECT USRPOPLNK.PID FROM [USRPOPLNK] WHERE USRPOPLNK.UID = (SELECT USER.UID FROM [USER],[MACHINE] WHERE MACHINE.MID = USER.MID AND MACHINE.M_NAME='" & mname & "' AND MACHINE.M_DOMAIN='" & domain & "'))", OleDbConnection1)

'.NET Framework Error handling : Try, Catch, Finally Block

Try

myOleDbConnection.Open()

myReader = myOleDbCommand.ExecuteReader()***

Catch ex As Exception

OleDbConnection1.Close()

MsgBox(ex.ToString)



Finally

myReader.Close()***

myOleDbConnection.Close()



End Try



End Sub


The error messages that im getting are concerning the points marked with ***

And are as follows (in order that they appear in script)

H:\Agile\Agility\Form1.vb(294): Value of type 'System.Data.OleDb.OleDbDataReader' cannot be converted to '1-dimensional array of System.Data.OleDb.OleDbDataReader'.

H:\Agile\Agility\Form1.vb(300): 'Close' is not a member of 'System.Array'.



Thanks guys.

Chris

Reply With Quote
  #2  
Old January 19th, 2004, 11:50 AM
nomi007 nomi007 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Pakistan
Posts: 8 nomi007 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Assgin memory to DataReader with "new" opreator and then try again. DataReader , DataSet , and OleDBCommand do no work untill u assign them memory with new opreators as they are objects in .NET

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - More.Net Development > OleDbDataReaders


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT