473,671 Members | 2,326 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

what is wrong?

I was trying to make a simple dataReader....

Sub projets()
Dim conn As New OleDbConnection (connstring)
Dim dr As OleDbDataReader ()
Dim cmd As New OleDbCommand()
cmd.CommandText = "select * from projeto order by nome"
cmd.Connection = conn
conn.Open()
dr = cmd.ExecuteRead er(CommandBehav ior.CloseConnec tion)
End Sub

what is wrong about it?

--
tks.

Daniel Sélen Secches
CWD Web Internet.
www.cwd.com.br
Nov 20 '05 #1
10 2257
Tom
what is wrong about it?


What errors are you getting?
Nov 20 '05 #2
Cor
Hi Daniel,
Sub projets()
Dim conn As New OleDbConnection (connstring)
Dim dr As OleDbDataReader ()
Dim cmd As New OleDbCommand()
cmd.CommandText = "select * from projeto order by nome"
cmd.Connection = conn
conn.Open()
dr = cmd.ExecuteRead er(CommandBehav ior.CloseConnec tion)
End Sub

what is wrong about it?


Is this the end

It can go like this

Dim rdr As SqlDataReader
rdr = cmd.ExecuteRead er()
Dim id As String
Dim pr As String
While rdr.Read()
id = rdr.GetInt32(0) .ToString
pr = rdr.GetString(1 )
End While
rdr.Close()

A little bit stupid like this because the id and pr is all the time
overwritten, but it just a sample.

I hope this helps?

Cor
Nov 20 '05 #3
I'm wondering if you are setting the connection of the
oledbcommand object to a closed connection. Try conn.open
first then set cmd.connection= conn.

-Lee
-----Original Message-----
I was trying to make a simple dataReader....

Sub projets()
Dim conn As New OleDbConnection (connstring)
Dim dr As OleDbDataReader ()
Dim cmd As New OleDbCommand()
cmd.CommandText = "select * from projeto order by nome" cmd.Connection = conn
conn.Open()
dr = cmd.ExecuteRead er (CommandBehavio r.CloseConnecti on)End Sub

what is wrong about it?

--
tks.

Daniel Sélen Secches
CWD Web Internet.
www.cwd.com.br
.

Nov 20 '05 #4
that error....

Value of type 'System.Data.Ol eDb.OleDbDataRe ader' cannot be converted to
'1-dimensional array of System.Data.Ole Db.OleDbDataRea der'.
"Tom" <Re**********@h ere.com> escreveu na mensagem
news:5v******** *************** *********@4ax.c om...
what is wrong about it?


What errors are you getting?

Nov 20 '05 #5
i've tried it but nothing ... : <

"Lee Moody" <an*******@disc ussions.microso ft.com> escreveu na mensagem
news:16******** *************** *****@phx.gbl.. .
I'm wondering if you are setting the connection of the
oledbcommand object to a closed connection. Try conn.open
first then set cmd.connection= conn.

-Lee
-----Original Message-----
I was trying to make a simple dataReader....

Sub projets()
Dim conn As New OleDbConnection (connstring)
Dim dr As OleDbDataReader ()
Dim cmd As New OleDbCommand()
cmd.CommandText = "select * from projeto order by nome" cmd.Connection = conn
conn.Open()
dr = cmd.ExecuteRead er (CommandBehavio r.CloseConnecti on)End Sub

what is wrong about it?

--
tks.

Daniel Sélen Secches
CWD Web Internet.
www.cwd.com.br
.

Nov 20 '05 #6
i'm getting the error on cmd.executeRead er(...) the "blue line" appears
under the cmd.executeRead er()

Value of type 'System.Data.Ol eDb.OleDbDataRe ader' cannot be converted to
'1-dimensional array of System.Data.Ole Db.OleDbDataRea der'.
I was just trying to do the exemple that a got from a book.... the exemple
is whit SQL server and i changed it to access DB

here is the book exemple:
=============== =============== ===============
Dm cn As New SqlConnection(" Server=(local)\ NetSDK;DataBase =pubs;Integrate d
Security=SSPI")
Dim dr As SqlDataReader
Dim cmd As New SqlCommand()
With cmd
.CommandText = "Select au_lname, au_fname from Authors"
.Connection = cn
End With
cn.Open()
dr = cmd.ExecuteRead er(CommandBehav ior.CloseConnec tion)
Dim strName As String
While dr.Read
' Add the items to the ListBox1 control
strName = dr("au_lname") & ", " & dr("au_fname")
MessageBox.Show (strName)
End While
cn.Close()
=============== =============== ===============
tks again

"Cor" <no*@non.com> escreveu na mensagem
news:u1******** *******@TK2MSFT NGP11.phx.gbl.. .
Hi Daniel,
Sub projets()
Dim conn As New OleDbConnection (connstring)
Dim dr As OleDbDataReader ()
Dim cmd As New OleDbCommand()
cmd.CommandText = "select * from projeto order by nome"
cmd.Connection = conn
conn.Open()
dr = cmd.ExecuteRead er(CommandBehav ior.CloseConnec tion)
End Sub

what is wrong about it?


Is this the end

It can go like this

Dim rdr As SqlDataReader
rdr = cmd.ExecuteRead er()
Dim id As String
Dim pr As String
While rdr.Read()
id = rdr.GetInt32(0) .ToString
pr = rdr.GetString(1 )
End While
rdr.Close()

A little bit stupid like this because the id and pr is all the time
overwritten, but it just a sample.

I hope this helps?

Cor

Nov 20 '05 #7
Dim dr As OleDbDataReader ()

take off the ()

"Daniel Sélen Secches" <danielATcwdDOT comDOTbr> wrote in message
news:uG******** ********@tk2msf tngp13.phx.gbl. ..
i'm getting the error on cmd.executeRead er(...) the "blue line" appears
under the cmd.executeRead er()

Value of type 'System.Data.Ol eDb.OleDbDataRe ader' cannot be converted to
'1-dimensional array of System.Data.Ole Db.OleDbDataRea der'.
I was just trying to do the exemple that a got from a book.... the exemple
is whit SQL server and i changed it to access DB

here is the book exemple:
=============== =============== ===============
Dm cn As New SqlConnection(" Server=(local)\ NetSDK;DataBase =pubs;Integrate d
Security=SSPI")
Dim dr As SqlDataReader
Dim cmd As New SqlCommand()
With cmd
.CommandText = "Select au_lname, au_fname from Authors"
.Connection = cn
End With
cn.Open()
dr = cmd.ExecuteRead er(CommandBehav ior.CloseConnec tion)
Dim strName As String
While dr.Read
' Add the items to the ListBox1 control
strName = dr("au_lname") & ", " & dr("au_fname")
MessageBox.Show (strName)
End While
cn.Close()
=============== =============== ===============
tks again

"Cor" <no*@non.com> escreveu na mensagem
news:u1******** *******@TK2MSFT NGP11.phx.gbl.. .
Hi Daniel,
Sub projets()
Dim conn As New OleDbConnection (connstring)
Dim dr As OleDbDataReader ()
Dim cmd As New OleDbCommand()
cmd.CommandText = "select * from projeto order by nome"
cmd.Connection = conn
conn.Open()
dr = cmd.ExecuteRead er(CommandBehav ior.CloseConnec tion)
End Sub

what is wrong about it?


Is this the end

It can go like this

Dim rdr As SqlDataReader
rdr = cmd.ExecuteRead er()
Dim id As String
Dim pr As String
While rdr.Read()
id = rdr.GetInt32(0) .ToString
pr = rdr.GetString(1 )
End While
rdr.Close()

A little bit stupid like this because the id and pr is all the time
overwritten, but it just a sample.

I hope this helps?

Cor


Nov 20 '05 #8
On Wed, 25 Feb 2004 15:44:11 -0300, "Daniel Sélen Secches"
<danielATcwdDOT comDOTbr> wrote:
that error....

Value of type 'System.Data.Ol eDb.OleDbDataRe ader' cannot be converted to
'1-dimensional array of System.Data.Ole Db.OleDbDataRea der'.

Get rid of the "()"

Nov 20 '05 #9
ohh god,,,, ,that was a stupid error..... i don't belive that

Now it's works....

tks again.....
"CJ Taylor" <no****@blowgoa ts.com> escreveu na mensagem
news:10******** *****@corp.supe rnews.com...
Dim dr As OleDbDataReader ()

take off the ()

"Daniel Sélen Secches" <danielATcwdDOT comDOTbr> wrote in message
news:uG******** ********@tk2msf tngp13.phx.gbl. ..
i'm getting the error on cmd.executeRead er(...) the "blue line" appears
under the cmd.executeRead er()

Value of type 'System.Data.Ol eDb.OleDbDataRe ader' cannot be converted to
'1-dimensional array of System.Data.Ole Db.OleDbDataRea der'.
I was just trying to do the exemple that a got from a book.... the exemple is whit SQL server and i changed it to access DB

here is the book exemple:
=============== =============== ===============
Dm cn As New SqlConnection(" Server=(local)\ NetSDK;DataBase =pubs;Integrate d Security=SSPI")
Dim dr As SqlDataReader
Dim cmd As New SqlCommand()
With cmd
.CommandText = "Select au_lname, au_fname from Authors"
.Connection = cn
End With
cn.Open()
dr = cmd.ExecuteRead er(CommandBehav ior.CloseConnec tion)
Dim strName As String
While dr.Read
' Add the items to the ListBox1 control
strName = dr("au_lname") & ", " & dr("au_fname")
MessageBox.Show (strName)
End While
cn.Close()
=============== =============== ===============
tks again

"Cor" <no*@non.com> escreveu na mensagem
news:u1******** *******@TK2MSFT NGP11.phx.gbl.. .
Hi Daniel,

> Sub projets()
> Dim conn As New OleDbConnection (connstring)
> Dim dr As OleDbDataReader ()
> Dim cmd As New OleDbCommand()
> cmd.CommandText = "select * from projeto order by nome"
> cmd.Connection = conn
> conn.Open()
> dr = cmd.ExecuteRead er(CommandBehav ior.CloseConnec tion)
> End Sub
>
> what is wrong about it?

Is this the end

It can go like this

Dim rdr As SqlDataReader
rdr = cmd.ExecuteRead er()
Dim id As String
Dim pr As String
While rdr.Read()
id = rdr.GetInt32(0) .ToString
pr = rdr.GetString(1 )
End While
rdr.Close()

A little bit stupid like this because the id and pr is all the time
overwritten, but it just a sample.

I hope this helps?

Cor



Nov 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

125
14711
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from software giant such as Microsoft SQL Server, Oracle, and Sybase? Is PostgreSQL reliable enough to be used for high-end commercial application? Thanks
5
2827
by: titan0111 | last post by:
#include<iostream> #include<iomanip> #include<cstring> #include<fstream> using namespace std; class snowfall { private: int ft;
72
5836
by: E. Robert Tisdale | last post by:
What makes a good C/C++ programmer? Would you be surprised if I told you that it has almost nothing to do with your knowledge of C or C++? There isn't much difference in productivity, for example, between a C/C++ programmers with a few weeks of experience and a C/C++ programmer with years of experience. You don't really need to understand the subtle details or use the obscure features of either language
121
10037
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode support IDEs are DreamWeaver 8 and Zend PHP Studio. DreamWeaver provides full support for Unicode. However, DreamWeaver is a web editor rather than a PHP IDE. It only supports basic IntelliSense (or code completion) and doesn't have anything...
28
3264
by: Madhur | last post by:
Hello what about this nice way to open a file in single line rather than using if and else. #include<stdio.h> void main() { FILE *nd; clrscr(); fopen("c:\\autoexec.bat","r")&&printf("success") || printf("error opeing
56
4318
by: Cherrish Vaidiyan | last post by:
Frinds, Hope everyone is doing fine.i feel pointers to be the most toughest part in C. i have just completed learning pointers & arrays related portions. I need to attend technical interview on C. wat type of questions should be expected? Which part of C language do the staff give more concern? The interviewers have just mentioned that .. i will have interview on C. Also can anyone can help me with sites where i can go thru sample
46
4198
by: Keith K | last post by:
Having developed with VB since 1992, I am now VERY interested in C#. I've written several applications with C# and I do enjoy the language. What C# Needs: There are a few things that I do believe MSFT should do to improve C#, however. I know that in the "Whidbey" release of VS.NET currently
13
5036
by: Jason Huang | last post by:
Hi, Would someone explain the following coding more detail for me? What's the ( ) for? CurrentText = (TextBox)e.Item.Cells.Controls; Thanks. Jason
9
2119
by: Pyenos | last post by:
import cPickle, shelve could someone tell me what things are wrong with my code? class progress: PROGRESS_TABLE_ACTIONS= DEFAULT_PROGRESS_DATA_FILE="progress_data" PROGRESS_OUTCOMES=
3
2140
by: Siong.Ong | last post by:
Dear all, my PHP aims to update a MySQL database by selecting record one by one and modify then save. Here are my PHP, but I found that it doesnt work as it supposed to be, for example, when Record (i) is shown and modified, the change will come to Record (i+1). Can anyone provide suggestion? thanks.
0
8472
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8819
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8596
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6222
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4221
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4399
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2806
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2048
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1801
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.