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