duvida Web Developer 2008

silencept

Power Member
Boas, neste momento apeteceu-me explorar o Web Developer 2008 da Microsoft.
Como ja acabei o meu super projecto em VB6, vou-me dedicando a isto..
mas surgiu este impasse...

gostaria que dessem uma vista de olhos..

tenho um form que tem cod_cliente(gerado automaticamente pela base de dados), morada, telefone,telemovel,código postal, data_registo e data de nascimento
tenho 2 botões, um novo, que limpa as textbox para escrever novos valores e um gravar para gravar os dados que eu inseri...

a questão agr é: ele não grava os dados na base de dados e eu não sei porque:

ele da erro aqui:

Erro de sintaxe na instrução INSERT INTO.
isto quando passa na instrução "comando.ExecuteNonQuery()"

aqui deixo o código

Código:
[SIZE=2][COLOR=#0000ff]Imports[/COLOR][/SIZE][SIZE=2][COLOR=#000000] System.Data.OleDb[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Imports[/COLOR][/SIZE][SIZE=2][COLOR=#000000] System.Data[/COLOR][/SIZE]
 
[SIZE=2][COLOR=#0000ff]Partial[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Class[/COLOR][/SIZE][SIZE=2][COLOR=#000000] Default2[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Inherits[/COLOR][/SIZE][SIZE=2] System.Web.UI.Page[/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] sql [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] conexao [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] OleDbConnection[/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] comando [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] OleDbCommand[/SIZE]
[SIZE=2][COLOR=#0000ff]Protected[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Page_Load([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Object[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].Load[/SIZE]
[SIZE=2][COLOR=#0000ff]On[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Error[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Resume[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Next[/COLOR][/SIZE]
 
[SIZE=2]txtnome.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]False[/COLOR][/SIZE]
[SIZE=2]txtmorada.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]False[/COLOR][/SIZE]
[SIZE=2]txtdescri.EnableViewState = [/SIZE][SIZE=2][COLOR=#0000ff]False[/COLOR][/SIZE]
[SIZE=2]txtloca.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]False[/COLOR][/SIZE]
[SIZE=2]txttelefone.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]False[/COLOR][/SIZE]
[SIZE=2]txttelemovel.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]False[/COLOR][/SIZE]
[SIZE=2]cmdcancelar.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]False[/COLOR][/SIZE]
[SIZE=2]cmdgravar.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]False[/COLOR][/SIZE]
[SIZE=2]txtdescri.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]False[/COLOR][/SIZE]
[SIZE=2]datanasc.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]False[/COLOR][/SIZE]
[SIZE=2]datareg.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]False[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Protected[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Button1_Click([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Object[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2] cmdnovo.Click[/SIZE]
[SIZE=2]txtnome.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]True[/COLOR][/SIZE]
[SIZE=2]txtmorada.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]True[/COLOR][/SIZE]
[SIZE=2]txtdescri.EnableViewState = [/SIZE][SIZE=2][COLOR=#0000ff]True[/COLOR][/SIZE]
[SIZE=2]txtloca.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]True[/COLOR][/SIZE]
[SIZE=2]txttelefone.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]True[/COLOR][/SIZE]
[SIZE=2]txttelemovel.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]True[/COLOR][/SIZE]
[SIZE=2]txtdescri.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]True[/COLOR][/SIZE]
[SIZE=2]cmdeditar.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]False[/COLOR][/SIZE]
[SIZE=2]cmdeliminar.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]False[/COLOR][/SIZE]
[SIZE=2]cmdcancelar.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]True[/COLOR][/SIZE]
[SIZE=2]cmdgravar.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]True[/COLOR][/SIZE]
[SIZE=2]datanasc.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]True[/COLOR][/SIZE]
[SIZE=2]datareg.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]True[/COLOR][/SIZE]
[SIZE=2]txtnome.Focus()[/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Protected[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] cmdgravar_Click([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Object[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2] cmdgravar.Click[/SIZE]
[SIZE=2][COLOR=#0000ff]On[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Error[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Resume[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Next[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] x [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] cmdnovo.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]True[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Then[/COLOR][/SIZE]
[SIZE=2]x = MsgBox([/SIZE][SIZE=2][COLOR=#a31515]"Tem a Certeza que digitou os Dados Correctos?"[/COLOR][/SIZE][SIZE=2], MsgBoxStyle.Question + MsgBoxStyle.YesNo, [/SIZE][SIZE=2][COLOR=#a31515]"DecisÆo"[/COLOR][/SIZE][SIZE=2])[/SIZE]
[SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] x = vbYes [/SIZE][SIZE=2][COLOR=#0000ff]Then[/COLOR][/SIZE]
[SIZE=2]sql = [/SIZE][SIZE=2][COLOR=#a31515]"Insert into Clientes(nome,morada,telefone,telemovel,memo,data_nasc,data_reg,cp"[/COLOR][/SIZE]
[SIZE=2]sql &= [/SIZE][SIZE=2][COLOR=#a31515]" values ('"[/COLOR][/SIZE][SIZE=2] & txtnome.Text & [/SIZE][SIZE=2][COLOR=#a31515]"','"[/COLOR][/SIZE][SIZE=2] & txtmorada.Text & [/SIZE][SIZE=2][COLOR=#a31515]"','"[/COLOR][/SIZE][SIZE=2] & txttelemovel.Text & [/SIZE][SIZE=2][COLOR=#a31515]"','"[/COLOR][/SIZE][SIZE=2] & txttelefone.Text & [/SIZE][SIZE=2][COLOR=#a31515]"','"[/COLOR][/SIZE][SIZE=2] & txtdescri.Text & [/SIZE][SIZE=2][COLOR=#a31515]"','"[/COLOR][/SIZE][SIZE=2] & txtdatanasc.Text & [/SIZE][SIZE=2][COLOR=#a31515]"','"[/COLOR][/SIZE][SIZE=2] & txtdatareg.Text & [/SIZE][SIZE=2][COLOR=#a31515]"','"[/COLOR][/SIZE][SIZE=2] & txtloca.Text & [/SIZE][SIZE=2][COLOR=#a31515]"'"[/COLOR][/SIZE]
[SIZE=2]conexao = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] OleDbConnection([/SIZE][SIZE=2][COLOR=#a31515]"Provider = microsoft.jet.oledb.4.0;data source=c:\Sistema\bd.mdb"[/COLOR][/SIZE][SIZE=2])[/SIZE]
[SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] conexao.State > ConnectionState.Open [/SIZE][SIZE=2][COLOR=#0000ff]Then[/COLOR][/SIZE][SIZE=2] conexao.Close()[/SIZE]
[SIZE=2]conexao.Open()[/SIZE]
[SIZE=2]comando = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] OleDbCommand(sql, conexao)[/SIZE]
[SIZE=2]comando.ExecuteNonQuery()[/SIZE]
[SIZE=2]conexao.Close()[/SIZE]
[SIZE=2][COLOR=#0000ff]Else[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Exit[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Protected[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] datareg_SelectionChanged([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Object[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2] datareg.SelectionChanged[/SIZE]
[SIZE=2]txtdatareg.Text = datareg.SelectedDate[/SIZE]
[SIZE=2]datareg.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]True[/COLOR][/SIZE]
[SIZE=2]datanasc.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]True[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Protected[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] datanasc_SelectionChanged([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Object[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2] datanasc.SelectionChanged[/SIZE]
[SIZE=2]txtdatanasc.Text = datanasc.SelectedDate[/SIZE]
[SIZE=2]datanasc.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]True[/COLOR][/SIZE]
[SIZE=2]datareg.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]True[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Protected[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] seguinte_Click([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Object[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2] seguinte.Click[/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Class[/COLOR][/SIZE]
Já agora, acrescentei 4 botões, um "Primeiro", "anterior","seguinte" e "Ultimo" e isto para fazer o mover o registo conforme prima o botão, como se cria esta rotina?que código devo usar?

Obrigado
(n se riam pk fiz isto td em apenas 1:30)
 
Última edição pelo moderador:
Eu não sou nenhum expert mas tu tens o IF que testa se a conexão está aberta, ora, se estiver aberta, fecha e abre outra vez a conexão, e dp executa o comando SQL.
Mas dp se por acaso a conexão estiver fechada, nem sequer a chegas a abrir pk sais do IF e do SUB.
Tens de ter uma opção para quando a conexão esta fechada.

Penso que seja isso.
 
Última edição:
não amigo, esta certo
se a conexão estiver aberta ele fecha e abre novamente com os dados que indico, se ele passar essa instrução é pk já se encontra fexado e é só perciso abrir...

mas onde ele da erro é na clausula comando.ExecuteNonQuery() que diz o seguinte erro:

Erro de sintaxe na instrução INSERT INTO.
 
Vê la se não te falta um ou dois ) no fim da instrução SQL.

sql = "Insert into Clientes(nome,morada,telefone,telemovel,memo,data_ nasc,data_reg,cp)"
sql &= " values ('" & txtnome.Text & "','" & txtmorada.Text & "','" & txttelemovel.Text & "','" & txttelefone.Text & "','" & txtdescri.Text & "','" & txtdatanasc.Text & "','" & txtdatareg.Text & "','" & txtloca.Text & "')"
 
Assim a primeira vista não me parece mais nada mal, como disse não sou nenhum expert.
Tenta fazer debug e tentar perceber o que está dentro da string SQL e testa no SQL Management Studio para perceber o que está mal.
 
Usa antes Sql em vez de oledb é mais facil e não causa tantos problemas.

Imports system.data.sql
Depois usas connection strings e por ai.
 
Boas, neste momento apeteceu-me explorar o Web Developer 2008 da Microsoft.
Como ja acabei o meu super projecto em VB6, vou-me dedicando a isto..
mas surgiu este impasse...

gostaria que dessem uma vista de olhos..

tenho um form que tem cod_cliente(gerado automaticamente pela base de dados), morada, telefone,telemovel,código postal, data_registo e data de nascimento
tenho 2 botões, um novo, que limpa as textbox para escrever novos valores e um gravar para gravar os dados que eu inseri...

a questão agr é: ele não grava os dados na base de dados e eu não sei porque:

ele da erro aqui:

Erro de sintaxe na instrução INSERT INTO.
isto quando passa na instrução "comando.ExecuteNonQuery()"

aqui deixo o código



Já agora, acrescentei 4 botões, um "Primeiro", "anterior","seguinte" e "Ultimo" e isto para fazer o mover o registo conforme prima o botão, como se cria esta rotina?que código devo usar?

Obrigado
(n se riam pk fiz isto td em apenas 1:30)
Cara, estou com o mesmo erro que você. Já testei o comando sql no access pois estou fazendo o banco de dados nele e funcionou, adicionou registro na tabela mas da erro na intrução insert into qndo executa o cmd.ExecuteNonQuery()
Já debuguei pra tentar descobrir algo e nada.


Segue abaixo o código
Código:
[SIZE=2][SIZE=2][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2][COLOR=#000000] Btn_salvar_Click([/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2][COLOR=#000000] sender [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#000000] System.Object, [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2][COLOR=#000000] e [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#000000] System.EventArgs) [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2][COLOR=#000000] Btn_salvar.Click[/COLOR]
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] constring [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][SIZE=2] = [/SIZE][SIZE=2][COLOR=#800000]"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\Arquivos\Gustavo\1- Faculdade\3º Periodo\Programação OO (Fábio)\01 - Projeto\SisCom 1.1\SisCom 1.1\SisCom.mdb;Persist Security Info=False"
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] DBcon [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] OleDb.OleDbConnection(constring)
DBcon.Open()
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] stringsql [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][SIZE=2] = [/SIZE][SIZE=2][COLOR=#800000]"insert into clientes(nome, end, bairro, cidade, uf, cep, telefone, celular, email, notas) values('"[/COLOR][/SIZE][SIZE=2] & txt_nome.Text & [/SIZE][SIZE=2][COLOR=#800000]"', '"[/COLOR][/SIZE][SIZE=2] & txt_end.Text & [/SIZE][SIZE=2][COLOR=#800000]"', '"[/COLOR][/SIZE][SIZE=2] & txt_bairro.Text & [/SIZE][SIZE=2][COLOR=#800000]"', '"[/COLOR][/SIZE][SIZE=2] & txt_cidade.Text & [/SIZE][SIZE=2][COLOR=#800000]"', '"[/COLOR][/SIZE][SIZE=2] & Cmb_uf.Text & [/SIZE][SIZE=2][COLOR=#800000]"', '"[/COLOR][/SIZE][SIZE=2] & Txt_cep.Text & [/SIZE][SIZE=2][COLOR=#800000]"', '"[/COLOR][/SIZE][SIZE=2] & Txt_tel.Text & [/SIZE][SIZE=2][COLOR=#800000]"', '"[/COLOR][/SIZE][SIZE=2] & Txt_cel.Text & [/SIZE][SIZE=2][COLOR=#800000]"', '"[/COLOR][/SIZE][SIZE=2] & txt_email.Text & [/SIZE][SIZE=2][COLOR=#800000]"', '"[/COLOR][/SIZE][SIZE=2] & txt_notas.Text & [/SIZE][SIZE=2][COLOR=#800000]"')"
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] cmd [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] OleDb.OleDbCommand(stringsql, DBcon)
cmd.CommandType = CommandType.Text
cmd.ExecuteNonQuery()
DBcon.Close()
MessageBox.Show([/SIZE][SIZE=2][COLOR=#800000]"Cliente"[/COLOR][/SIZE][SIZE=2] & txt_nome.Text & [/SIZE][SIZE=2][COLOR=#800000]"gravado com sucesso!"[/COLOR][/SIZE][SIZE=2])
Beep()
Btn_salvar.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]False
[/COLOR][/SIZE][SIZE=2]Btn_cancelar.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]False
[/COLOR][/SIZE][SIZE=2]Btn_novo.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]True
[/COLOR][/SIZE][SIZE=2]Btn_editar.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]True
[/COLOR][/SIZE][SIZE=2]Btn_excluir.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]True
[/COLOR][/SIZE][SIZE=2]txt_nome.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]False
[/COLOR][/SIZE][SIZE=2]txt_bairro.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]False
[/COLOR][/SIZE][SIZE=2]txt_cidade.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]False
[/COLOR][/SIZE][SIZE=2]txt_email.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]False
[/COLOR][/SIZE][SIZE=2]txt_notas.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]False
[/COLOR][/SIZE][SIZE=2]txt_end.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]False
[/COLOR][/SIZE][SIZE=2]Txt_cel.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]False
[/COLOR][/SIZE][SIZE=2]Txt_tel.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]False
[/COLOR][/SIZE][SIZE=2]Txt_cep.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]False
[/COLOR][/SIZE][SIZE=2]Cmb_uf.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]False
[/COLOR][/SIZE][SIZE=2]txt_nome.Text = [/SIZE][SIZE=2][COLOR=#800000]""
[/COLOR][/SIZE][SIZE=2]txt_end.Text = [/SIZE][SIZE=2][COLOR=#800000]""
[/COLOR][/SIZE][SIZE=2]txt_bairro.Text = [/SIZE][SIZE=2][COLOR=#800000]""
[/COLOR][/SIZE][SIZE=2]txt_cidade.Text = [/SIZE][SIZE=2][COLOR=#800000]""
[/COLOR][/SIZE][SIZE=2]Cmb_uf.Text = [/SIZE][SIZE=2][COLOR=#800000]""
[/COLOR][/SIZE][SIZE=2]Txt_cep.Text = [/SIZE][SIZE=2][COLOR=#800000]""
[/COLOR][/SIZE][SIZE=2]Txt_tel.Text = [/SIZE][SIZE=2][COLOR=#800000]""
[/COLOR][/SIZE][SIZE=2]Txt_cel.Text = [/SIZE][SIZE=2][COLOR=#800000]""
[/COLOR][/SIZE][SIZE=2]txt_email.Text = [/SIZE][SIZE=2][COLOR=#800000]""
[/COLOR][/SIZE][SIZE=2]txt_notas.Text = [/SIZE][SIZE=2][COLOR=#800000]""
[/COLOR][/SIZE][/SIZE]

Alguem ae pode nos ajudar?
 
Última edição pelo moderador:
Logo depois de me cadastrar, e pedir ajuda aqui achei no site de suport da microsoft o erro do meu projeto.

O campo END que seria endereço é uma palavra reservada do Microsoft Jet 4.0 e isso estava fazendo a inclusão no banco nao funcionar, dps da alteração pra endereco funcinou corretamente.
No site dizia que esse erro ocorre com o access 2003.

Segue a baixo o link com as palavras reservadas em Jet 4.0:

http://support.microsoft.com/kb/248738/

Site do suporte microsoft onde encontrei o pq do erro:

http://support.microsoft.com/kb/892608/pt
 
Guga123,

Só agora vi o seu post mas por isso, e para evitar problemas com as palavras reservadas, devesse colocar os nomes dos campos com parênteses rectos. Ex:

SELECT [campo1], [campo2], [end], [password] FROM myTable
 
Obrigado...

ta resolvido, ja agora

eu no vb fazia "Cliente.movenext" para mover o registo, como movelast, moveprevious, move first...
como posso fazer isto no web developer?

da para utilizar o adodc no web developer?aquele controlo que tem no vb6...como?
 
Back
Topo