tonyjony
Membros-
Total de itens
1 -
Registro em
-
Última visita
Sobre tonyjony
tonyjony's Achievements
0
Reputação
-
Desculpe sou leigo ainda em programação. Estou tentando criar um programa de cadastro e ao tentar gravar um arquivo pdf apresenta o seguinte erro. A first chance exception of type 'System.Data.OleDb.OleDbException' occurred in System.Data.dll o codigo é o seguinte. Imports System.Data Imports System.Data.OleDb Imports System.IO Public Class frmCadastroDocumentos Public Sub PCarregaDocumento() If Ofd.ShowDialog = Windows.Forms.DialogResult.OK Then If String.IsNullOrEmpty(Ofd.FileName) Then Return End If Try txtDocumento.Text = Ofd.FileName Catch ex As Exception MsgBox("Ocorreu um erro ao tentar selecionar o arquivo.", MsgBoxStyle.Critical) End Try End If End Sub Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles btnPesquisar.Click PCarregaDocumento() End Sub Private Sub PGravarDocumento() Using con As OleDbConnection = GetConnection() Try con.Open() Dim sql As String = "INSERT INTO documento (documento, descricao) VALUE (?,?)" Dim cmd As OleDbCommand = New OleDbCommand(sql, con) cmd.Parameters.Add(New OleDb.OleDbParameter("@documento", File.ReadAllBytes(txtDocumento.Text))) cmd.Parameters.Add(New OleDb.OleDbParameter("@descricao,", txtDescricao)) cmd.ExecuteNonQuery() txtDocumento.Text = "" txtDescricao.Text = "" MsgBox("Documento gravado com sucesso.", MsgBoxStyle.Information) Catch ex As Exception Finally con.Close() End Try End Using