ERRO ENVIO DE DADOS RELATORIO

HOSTTOTA 09/03/2012 10:02:56
#396773
Citação:

:: Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
carrega_rel()
End Sub


Private Sub carrega_rel()
Dim conn As OleDb.OleDbConnection
Dim cmd As New OleDb.OleDbCommand
Dim da As New OleDb.OleDbDataAdapter
Dim dsum As New DataSet
Dim oTable As New DataTable()
Dim strReportPath As String = ''

Try
strReportPath = String.Concat(Replace(My.Application.Info.DirectoryPath(), '\bin\Debug', ''), '\Report1.rdlc')
ReportViewer1.LocalReport.ReportPath = strReportPath


' declarando string de conexão
Dim Conect As String = My.Settings.bancoConnectionString
' comando de conxao
Dim Conectar As New OleDb.OleDbConnection
Conectar.ConnectionString = Conect
Conectar.Open()

'comando de comenado dos bancos
Dim selcom As New OleDb.OleDbCommand
selcom.Connection = Conectar
'traz todos campos do cliente
selcom.CommandText = 'SELECT * FROM Produtos WHERE Produto LIKE '%'+ '' & TextBox1.Text & '' +'%' '
selcom.CommandType = CommandType.Text


Dim oDataReader As OleDb.OleDbDataReader = cmd.ExecuteReader()
oTable.Load(oDataReader)

Dim myReportDataSource As ReportDataSource = New ReportDataSource('bancoConnectionString', oTable)

ReportViewer1.Clear()
ReportViewer1.LocalReport.DataSources.Item(0) = myReportDataSource

Me.ReportViewer1.RefreshReport()
Conectar.Close()

Catch ex As Exception
MsgBox(ex.Message)
End Try

oTable.Dispose()
conn = Nothing
oTable = Nothing




como posso arrumar isso
porque com sql vai mais oledb nao
ALTAIR148 09/03/2012 10:04:31
#396774
Bom dia,

Se tiver a mensagem de erro facilita muito.
HOSTTOTA 09/03/2012 10:30:49
#396779
erro no ExecuteReader: propriedade Connection não foi inicializada
mais estranho q uso mesma conexao para outras pesquisa e ta normal
Tópico encerrado , respostas não são mais permitidas