473,544 Members | 2,249 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 2239
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
14571
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
2822
by: titan0111 | last post by:
#include<iostream> #include<iomanip> #include<cstring> #include<fstream> using namespace std; class snowfall { private: int ft;
72
5748
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...
121
9921
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...
28
3235
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
4283
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 .....
46
4164
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
5009
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
2111
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
2136
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
7374
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7783
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...
1
7392
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...
0
7720
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5309
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...
0
4930
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1850
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
1
996
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
677
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...

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.