Jump to content
Fórum Script Brasil
  • 0

Erro


Ricardo Ciro
 Share

Question

ola, sou iniciante no vb.net.´

escrevi um codigo, que faz uma pesquisa e retorna valores nos campos do sistema.

fiz um exemplo pequeno com 6 campos e funcionou legal, porem quando escrevi novamente para o sistema que vou usar ele deu um erro .

( IErrorInfo.getDescrption failed with E_FAIL (0x80004005) )

o caminho do bd criei em um modulo

segue

Module Module1

Public con As New System.Data.OleDb.OleDbConnection("Provider = Microsoft.jet.OleDB.4.0;Data Source = " & Application.StartupPath & "\sisb.mdb;")

Public idno, mno As Integer

Public str As String

End Module

segue o codigo

Imports System.Data.OleDb

Imports System.io

Imports System.drawing

Public Class Frmcad

Private Sub pbxSair_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pbxSair.Click

Me.Close()

End Sub

Private Sub Frmcad_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub

Public Sub carregaDados()

Dim ds As New DataSet

Dim dt As New DataTable

Dim adptr As New OleDbDataAdapter("select * from setor", con)

adptr.Fill(ds, "setor")

dt = ds.Tables(0)

End Sub

Private Sub pbxPesquisar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pbxPesquisar.Click

Try

If con.State = ConnectionState.Closed Then con.Close()

con.Open()

Dim cmd As New OleDbCommand("select * from setor WHERE sql = " & Txtsql.Text, con)

Dim drdr As OleDbDataReader

drdr = cmd.ExecuteReader

drdr.Read()

Txttipo1.Text = drdr("tipo1")

Txttitulo1.Text = drdr("titulo1")

Txtnome1.Text = drdr("nome1")

Txtext1.Text = drdr("extensao1")

Txtclass1.Text = drdr("class1")

Txtlarg1.Text = drdr("larg1")

Txtofic1.Text = drdr("ofic1")

Txtcodlog1.Text = drdr("codlog1")

Txttipo2.Text = drdr.Item("tipo2")

Txttitulo2.Text = drdr.Item("titulo2")

Txtdenom2.Text = drdr.Item("nome2")

Txtext2.Text = drdr.Item("extensao2")

Txtclass2.Text = drdr.Item("class2")

Txtlarg2.Text = drdr.Item("larg2")

Txtofic2.Text = drdr.Item("ofic2")

Txtcodlog2.Text = drdr.Item("codlog2")

Txttipo3.Text = drdr.Item("tipo3")

Txttitulo3.Text = drdr.Item("titulo3")

Txtdenom3.Text = drdr.Item("nome3")

Txtext3.Text = drdr.Item("extensao3")

Txtclass3.Text = drdr.Item("class3")

Txtlarg3.Text = drdr.Item("larg3")

Txtofic3.Text = drdr.Item("ofic3")

Txtcodlog3.Text = drdr.Item("codlog3")

Txttipo4.Text = drdr.Item("tipo4")

Txttitulo4.Text = drdr.Item("titulo4")

Txtdenom4.Text = drdr.Item("nome4")

Txtext4.Text = drdr.Item("extensao4")

Txtclass4.Text = drdr.Item("class4")

Txtlarg4.Text = drdr.Item("larg4")

Txtofic4.Text = drdr.Item("ofic4")

Txtcodlog4.Text = drdr.Item("codlog4")

Txttipo5.Text = drdr.Item("tipo5")

Txttitulo5.Text = drdr.Item("titulo5")

Txtdenom5.Text = drdr.Item("nome5")

Txtext5.Text = drdr.Item("extensao5")

Txtclass5.Text = drdr.Item("class5")

Txtlarg5.Text = drdr.Item("larg5")

Txtofic5.Text = drdr.Item("ofic5")

Txtcodlog5.Text = drdr.Item("codlog5")

Txtmacro.Text = drdr.Item("mequ")

Txtzona.Text = drdr.Item("desmequ")

Txtze.Text = drdr.Item("ze")

Txtcodigoze = drdr.Item("desze")

Txtzc.Text = drdr.Item("logzcl")

Txtcodigozc.Text = drdr.Item("deslgzcl")

Txtrestr.Text = drdr.Item("rest")

Txtooi.Text = drdr.Item("obj")

Txtppa.Text = drdr.Item("ppaero")

Txtcodigoppa.Text = drdr.Item("desppaero")

Txtmelho.Text = drdr.Item("melhor")

Txtat.Text = drdr.Item("tomb")

Txtconfronto.Text = drdr.Item("conf")

Txtconfrontoqual.Text = drdr.Item("desconf")

Txtcritico.Text = drdr.Item("enchente")

Txtcontaminada.Text = drdr.Item("contaminada")

Txtsituacao.Text = drdr.Item("situacao")

cmd.Cancel()

con.Close()

Catch ex As Exception

MsgBox(ex.Message)

End Try

End Sub

End Class

alguém poderia dar um help

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Forum Statistics

    • Total Topics
      149.8k
    • Total Posts
      646.6k
×
×
  • Create New...