none
Nenhum valor foi fornecido para um ou mais parâmetros necessários. RRS feed

  • Pergunta

  • Imports System.Data.OleDb
    Public Class Form2
        Dim cn As New OleDb.OleDbConnection
        Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            cn.ConnectionString = (" Provider=Microsoft.ACE.OLEDB.12.0 ;Data Source=E:\ \RegistoAutomovel(Estagio)\Base de Dados2.accdb")
            cn.Open()
            Datagridshow()
            CBxNumSocio.Checked = True
            CBCarta.Checked = True
            CBCc.Checked = True
            CBCodPostal.Checked = True
            CBMorada.Checked = True
            CBDataFide.Checked = True
            CBDataNasc.Checked = True
            CBTelefone.Checked = True
            CBTelemovel.Checked = True
            CBNome.Checked = True
            CBEstado.Checked = False
            CBLocal.Checked = False
            CBLocalidade.Checked = False
            CBLocalNasc.Checked = False
            CBAnual.Checked = False
            CBDataEmissao.Checked = False
            CBData.Checked = False
            CBNif.Checked = False
            CBNProp.Checked = False
            CBSEm1.Checked = False
            CBSem2.Checked = False
            CBEmail.Checked = False
            CBContribuinte.Checked = False
            CBDistrito.Checked = False
            CBPais.Checked = False
            CBEmail.Checked = False
        End Sub
        Private Sub DatagridShow()
            Dim da As OleDb.OleDbDataAdapter
            Dim dt As New DataTable
            Dim ds As New DataSet
            ds.Tables.Add(dt)
            'Preenche as colunas
            'da = New OleDb.OleDbDataAdapter("SELECT N_Socio, Nome, Data_Nasc, Cod_Postal, Morada FROM Clube", cn)
            'da.Fill(dt)
            'Me.DataGridView1.DataSource = dt.DefaultView
            da = New OleDb.OleDbDataAdapter("SELECT * FROM Clube", cn)
            da.Fill(dt)
            Me.DataGridView1.DataSource = dt.DefaultView
            cn.Close()
        End Sub
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BttMenu.Click
            Me.Hide()
            MenuPrincipal.Show()
        End Sub
        Private Sub BttEliminar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
            'Suposto eleminar dados mas ainda nao testei
            'Dim con As OleDbConnection
            'Dim com As OleDbCommand
            'con = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source= C:\Users\Pasindu\Documents\database9.accdb")
            'com = New OleDbCommand("delete from Table1 where Student number = DataGridView1.SelectedCells.Item", con)
            'con.Open()
            'com.Parameters.AddWithValue("@sno", TextBox1.Text)
            'com.ExecuteNonQuery()
            'MsgBox("Record Deleted")
            'con.Close()
        End Sub
        Private Sub EscSair_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress
            If e.KeyChar = Chr(27) Then
                Me.Hide()
                MenuPrincipal.Show()
            End If
        End Sub
        Private Sub CBxNumSocio_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CBxNumSocio.CheckedChanged
            If CBxNumSocio.Checked Then
                DataGridView1.Columns(0).Visible = True
            Else
                DataGridView1.Columns(0).Visible = False
            End If
        End Sub

    Boas este é o meu Codigo em vb e o problema é o erro com o nome do titulo e só da na parte o "insert into" se usar os campos da tabela de cada vez e no campo que corresponde ao bi/cc pois se usar Select into *... não tenho problemas os dados aparecem todos no datagridview 
    quinta-feira, 20 de junho de 2013 16:26