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