472,353 Members | 1,591 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 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 2155
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...
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...
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...
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;...
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...
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. ...
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. ...
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=...
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...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

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.