473,322 Members | 1,307 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

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.ExecuteReader(CommandBehavior.CloseConnection)
End Sub

what is wrong about it?

--
tks.

Daniel Sélen Secches
CWD Web Internet.
www.cwd.com.br
Nov 20 '05 #1
10 2218
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.ExecuteReader(CommandBehavior.CloseConnection)
End Sub

what is wrong about it?


Is this the end

It can go like this

Dim rdr As SqlDataReader
rdr = cmd.ExecuteReader()
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.ExecuteReader (CommandBehavior.CloseConnection)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.OleDb.OleDbDataReader' cannot be converted to
'1-dimensional array of System.Data.OleDb.OleDbDataReader'.
"Tom" <Re**********@here.com> escreveu na mensagem
news:5v********************************@4ax.com...
what is wrong about it?


What errors are you getting?

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

"Lee Moody" <an*******@discussions.microsoft.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.ExecuteReader (CommandBehavior.CloseConnection)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.executeReader(...) the "blue line" appears
under the cmd.executeReader()

Value of type 'System.Data.OleDb.OleDbDataReader' cannot be converted to
'1-dimensional array of System.Data.OleDb.OleDbDataReader'.
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 ;Integrated
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.ExecuteReader(CommandBehavior.CloseConnection)
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***************@TK2MSFTNGP11.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.ExecuteReader(CommandBehavior.CloseConnection)
End Sub

what is wrong about it?


Is this the end

It can go like this

Dim rdr As SqlDataReader
rdr = cmd.ExecuteReader()
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" <danielATcwdDOTcomDOTbr> wrote in message
news:uG****************@tk2msftngp13.phx.gbl...
i'm getting the error on cmd.executeReader(...) the "blue line" appears
under the cmd.executeReader()

Value of type 'System.Data.OleDb.OleDbDataReader' cannot be converted to
'1-dimensional array of System.Data.OleDb.OleDbDataReader'.
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 ;Integrated
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.ExecuteReader(CommandBehavior.CloseConnection)
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***************@TK2MSFTNGP11.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.ExecuteReader(CommandBehavior.CloseConnection)
End Sub

what is wrong about it?


Is this the end

It can go like this

Dim rdr As SqlDataReader
rdr = cmd.ExecuteReader()
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"
<danielATcwdDOTcomDOTbr> wrote:
that error....

Value of type 'System.Data.OleDb.OleDbDataReader' cannot be converted to
'1-dimensional array of System.Data.OleDb.OleDbDataReader'.

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****@blowgoats.com> escreveu na mensagem
news:10*************@corp.supernews.com...
Dim dr As OleDbDataReader()

take off the ()

"Daniel Sélen Secches" <danielATcwdDOTcomDOTbr> wrote in message
news:uG****************@tk2msftngp13.phx.gbl...
i'm getting the error on cmd.executeReader(...) the "blue line" appears
under the cmd.executeReader()

Value of type 'System.Data.OleDb.OleDbDataReader' cannot be converted to
'1-dimensional array of System.Data.OleDb.OleDbDataReader'.
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 ;Integrated 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.ExecuteReader(CommandBehavior.CloseConnection)
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***************@TK2MSFTNGP11.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.ExecuteReader(CommandBehavior.CloseConnection)
> End Sub
>
> what is wrong about it?

Is this the end

It can go like this

Dim rdr As SqlDataReader
rdr = cmd.ExecuteReader()
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
ohh god,,,, ,that was a stupid error..... i don't belive that

Now it's works....

tks again.....

"_Andy_" <wi******@nospamthanks.gov> escreveu na mensagem
news:rd********************************@4ax.com...
On Wed, 25 Feb 2004 15:44:11 -0300, "Daniel Sélen Secches"
<danielATcwdDOTcomDOTbr> wrote:
that error....

Value of type 'System.Data.OleDb.OleDbDataReader' cannot be converted to
'1-dimensional array of System.Data.OleDb.OleDbDataReader'.

Get rid of the "()"

Nov 20 '05 #11

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

Similar topics

125
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...
5
by: titan0111 | last post by:
#include<iostream> #include<iomanip> #include<cstring> #include<fstream> using namespace std; class snowfall { private: int ft;
72
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...
121
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...
28
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();...
56
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...
46
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...
13
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
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
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.