Jump to content
Fórum Script Brasil
  • 0
Sign in to follow this  
mika

vb.net

Question

Estou tentando desenvolver um projeto com banco de dados no access, mas não estou conseguindo abrir o banco de dados.

Dim cmd As OleDbCommand
    Dim dr As OleDbDataReader
    Dim sql As String
    Dim strconexao As String = "provider = microsoft.ace.oledb.12.0;dataSource = C:\Documents and Settings\Marcio\Desktop\Todos Sistemas\sistema.mdb; persist security info = false;"
    Dim cn = New System.Data.OleDb.OleDbConnection(strconexao)

botao inserir
 sql = " insert into banco values"
        sql += "'" & textcliente.Text & "'"
        sql += "'" & Textsolicitante.Text & "'"
        sql += "'" & Textautorizador.Text & "'"
        sql += "'" & Textendereço.Text & "'"
        sql += "'" & Textnumero.Text & "'"
        sql += "'" & Textbairro.Text & "'"
        sql += "'" & Textcidade.Text & "'"
        sql += "'" & Textcep.Text & "'"
        sql += "'" & textreferencia.Text & "'"
        sql += "'" & Textemail.Text & "'"
        sql += "'" & Texttelefone.Text & "'"
        sql += "'" & Texttelefone1.Text & "'"
        sql += "'" & Texttelefone2.Text & "'"
        sql += "'" & Texttelefone3.Text & "'"

        Try
            cn = New OleDbConnection(strconexao)
            cn.Open()

            cmd = New OleDbCommand(sql, cn)
            cmd.ExecuteNonQuery()

        catch

            cn = Nothing
            MsgBox(Err.Description)
        End Try

    End Sub

o que posso fazer.

grato.

Edited by kuroi
Adicionar tag CODE

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Visual Basic .NET tem q ser na sala de .NET.

um erro q eu vi aqui, é q, no insert os values() tem q estar entre parenteses. tipo assim:

Insert Into Tabela Values(valor1, valor2)

Share this post


Link to post
Share on other sites

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.

Sign in to follow this  

Cloud Computing


  • Forum Statistics

    • Total Topics
      148600
    • Total Posts
      644295
×
×
  • Create New...