NVmania - Maníacos por games e tecnologia!  

Voltar   NVmania - Maníacos por games e tecnologia! > Design e Programação / Desenvolvimento > Programação / Desenvolvimento

Resposta
 
LinkBack Ferramentas do Tópico Modos de Exibição
  #1 (permalink)  
Antigo 03-30-2010, 03:20 PM
Avatar de Marcos Aurelio
Marcos
 
Registrado em: Feb 2009
Localização: MG
Posts: 110
Padrão Empacado no Vb!!!

Ola, pessoal.

estou iniciando na programação, Estou apredendo a linguagem Vb. No curso que estou fazendo estamos trbalhando em um projeto que existe um banco de dados SQl
e a plicação faz uma conexão com o mesmo. Mas estou tendo alguns problemas, na hora de inserir dados pelo formulario. Ja tentei de tudo,
fiz varias pesquisas na net e não consegui encontrar nada. Se alguem poder me ajudar?

O codigo que fiz esta assim:

Private Sub btnGravar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGravar.Click
Dim SqlCmd As SqlCommand
Dim Resultado As Int32
Dim StrSql As String
Conectar()
StrSql = "insert funcionario"
StrSql = StrSql & "matricula_func = " & txtMatricula.Text.Trim & ","
StrSql = StrSql & "nome_func = " & txtNome.Text.Trim & ","
StrSql = StrSql & "cpf_func = " & mskCpf.Text.Trim & ","
StrSql = StrSql & "rg_func = " & mskRg.Text.Trim & ","
StrSql = StrSql & "rua_end_func = " & txtAvrua.Text.Trim & ","
StrSql = StrSql & "nr_end_func = " & txtNr.Text.Trim & ","
StrSql = StrSql & "compl_end_func = " & txtComplemento.Text.Trim & ","
StrSql = StrSql & "bairro_func = " & txtBairro.Text.Trim & ","
StrSql = StrSql & "cidade_func = " & txtCidade.Text.Trim & ","
StrSql = StrSql & "cep_end_func = " & mskCep.Text.Trim & ","
StrSql = StrSql & "codigo_uf = " & cmbUf.SelectedIndex & ","
StrSql = StrSql & "ddd_res_func = " & txtDddres.Text.Trim & ","
StrSql = StrSql & "fone_res_func = " & txtFoneres.Text.Trim & ","
StrSql = StrSql & "ddd_cel_func = " & txtFonecel.Text.Trim & ","
StrSql = StrSql & "sexom_func = " & rdbSexom.Checked & ","
StrSql = StrSql & "sexof_func = " & rdbSexof.Checked & ","
StrSql = StrSql & "est_civil_func = " & cmbEstacivil.SelectedIndex & ","
StrSql = StrSql & "dependentes_func = " & cmbDependentes.SelectedIndex & ","
StrSql = StrSql & "codigo_cargo = " & cmbCargo.SelectedIndex & ","
StrSql = strSql & "func_ativo = " & ckbativo.Checked & "," 'Isto é uma checkbox
StrSql = StrSql & "salario_func = " & txtSalario.Text.Trim
SqlCmd = New SqlCommand(StrSql, AdoConn)
Resultado = SqlCmd.ExecuteNonQuery
Desconectar()
LimparCampos()

Se alguem poder me dizer onde esta o erro (imagino que tenha aos montes), poderia me dizer e me passar
como poderia estar fazendo.

Desde ja obrigado. Abraços!!!
__________________
Jogando: Pac-Man, Enduro, River Ride
Responder com Citação
Resposta

Usuários Ativos Atualmente Vendo Esse Tópico: 1 (0 membros e 1 visitantes)
 
Ferramentas do Tópico
Modos de Exibição

Regras para Posts
Você não pode postar novos tópicos
Você não pode postar respostas
Você não pode postar anexos
Você não pode editar seus posts

Código [IMG] Sim
Código HTML Sim
Trackbacks are Sim
Pingbacks are Sim
Refbacks are Sim

Ir para...

Horários baseados na GMT -3. Agora são 06:00 AM.
Todos direitos reservados: www.nvmania.com.br




Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
:: Translated by vB-Brasil
NVmania 2007@2009