Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

cesarhtc

INSERT EM DUAS TABELAS

Recommended Posts

Estou tentando gravar um formulario p/ duas tabelas, só que nada.

Esta dando erro na linha em negrito

 

Valeu pela força :unsure:

 

Cesarhtc

 

ASP [/tr][tr]

<%

 

'Recupera do Inclu_ResultSQLnovo.asp o valor das variáveis passadas

wUF = Request.form("SG_UF")

wModal = Request.form("SG_Modalidade")

wNL = Request.form("NU_NL")

wPublicar = Request.form("DT_Publicar")

wFornecedor = Request.form("NM_Fornecedor")

wItem = Request.form("NU_Item")

wObjeto = Request.form("TE_Objeto")

wValor = Request.form("VL_Valor")

wentrada = Request.form("TE_Entrada")

wStatus = Request.form("NM_Status")

wId_Edital = Request.form("ID_Edital")

 

'response.write wuf & "<BR>" & wmodal & "<BR>" & wnl & "<BR>" & wpublicar & "<BR>" & wfornecedor & "<BR>" & witem & "<BR>" & wobjeto & "<BR>" & wvalor & "<BR>" & wentrada & "<BR>" & wstatus & "<BR>" & wid_edital & "<BR>"

 

' Mostra a variável de conexão

Conexao="Provider=SQLOLEDB; Data Source=10.2.9.125; Initial Catalog=Publicar; User ID=sa; Password=''"

 

'response.end

 

'Cria um objeto recordset

set rstMain = Server.CreateObject("ADODB.Recordeset")

 

rstMain.Open strSQL,conexao

 

wentrada = now()

wID_Edital =wuf&wmodal&wnl

 

'MONTA A STRING SQL DE INCLUSÃO NA TABELA PUBLICAR

strSQL = "INSERT INTO resultado ( SG_UF, SG_MODALIDADE, NU_NL, DT_PUBLICAR, TE_ENTRADA, NM_STATUS, ID_EDITAL) " &_

" VALUES (' "& wuf &" ' , ' "& wmodal &" ' , ' "& wnl &" ' , ' "& wpublicar &" ' , ' " & wentrada &" ', ' " & wstatus &" ', ' " & wid_edital & " ')"

 

'response.write strSQL &"<BR>"

 

'response.end

 

rstMain.Close

 

 

'Conecta ao BD pelo DSN e abre a consulta

 

rstMain.Open strSQL, conexao

 

wentrada = now()

wID_Edital =wuf&wmodal&wnl

 

'MONTA A STRING SQL DE INCLUSÃO NA TABELA PUBLICAR

strSQL = "INSERT INTO resuitem (SG_UF, SG_MODALIDADE, NU_NL, NU_ITEM, NM_FORNECEDOR,TE_OBJETO, VL_VALOR, DT_PUBLICAR, TE_ENTRADA, NM_STATUS, ID_EDITAL) " &_

" VALUES (' "& wuf &" ', ' " & wmodal &" ', ' " & wnl &" ', ' " & witem & " ', ' "& wfornecedor & " ',' " & wobjeto &" ', ' " & wvalor & " ' , ' " & wpublicar & " ', ' " & wentrada &" ', ' " & wstatus &" ', ' " & wid_edital & " ')"

 

 

'response.write strSQL

 

'response.end

 

rstMain.Close

 

 

'Conecta ao BD pelo DSN e abre a consulta

 

rstMain.Open strSQL, conexao

 

%>

 

<h2>A inclusão foi efetuada.</h2>

<hr>

 

<%

 

 

 

'Libera a memória (destrói o objeto recordset)

Set rstMain=Nothing

%>

[/tr]

Compartilhar este post


Link para o post
Compartilhar em outros sites

certeza que o erro é nesta linha??Ou é no open de baixo??Posta o erro ai

Compartilhar este post


Link para o post
Compartilhar em outros sites

A mensagem que aparece esta.

ASP [/tr][tr]

 

Technical Information (for support personnel)

 

Error Type:

Server object, ASP 0177 (0x800401F3)

Invalid ProgID. For additional information specific to this message please visit the Microsoft Online Support site located at: http://www.microsoft.com/contentredirect.asp.

/suprimentos/publicar/gravarResultado.asp, line 32

 

 

Browser Type:

Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)

 

Page:

POST 158 bytes to /suprimentos/publicar/gravarResultado.asp

 

POST Data:

SG_UF=Filial-RJ&SG_MODALIDADE=PG&NU_NL=452004&NU_ITEM=1&VL_VALOR=464&NM_FORNECEDOR=hkhk&TE_Objeto=khkh&DT_Publicar=19%2F10%2F2004&TE_Entrada=&NM_Status=Normal

 

[/tr]

Compartilhar este post


Link para o post
Compartilhar em outros sites
[tr][/tr][tr][/tr]
ASP set rstMain = Server.CreateObject("ADODB.Recordeset")

 

rstMain.Open strSQL,conexao

 

cara você montou a strSQL antes de abrir o rstMain?

Compartilhar este post


Link para o post
Compartilhar em outros sites

acho que é so jogar esta montagem lá pra cima

Compartilhar este post


Link para o post
Compartilhar em outros sites

Inverti e agora aparece este erro.

 

ASP [/tr][tr]

rstMain.Open strSQL,conexao

 

'Cria um objeto recordset

set rstMain = Server.CreateObject("ADODB.Recordeset")

[/tr]

 

 

ASP [/tr][tr]

Technical Information (for support personnel)

 

Error Type:

Microsoft VBScript runtime (0x800A01A8)

Object required: ''

/suprimentos/publicar/gravarResultado.asp, line 31

 

 

Browser Type:

Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)

 

Page:

POST 158 bytes to /suprimentos/publicar/gravarResultado.asp

 

POST Data:

SG_UF=Filial-RJ&SG_MODALIDADE=PG&NU_NL=452004&NU_ITEM=1&VL_VALOR=464&NM_FORNECEDOR=hkhk&TE_Objeto=khkh&DT_Publicar=19%2F10%2F2004&TE_Entrada=&NM_Status=Normal

[/tr]

Compartilhar este post


Link para o post
Compartilhar em outros sites

Não era bem isso

 

 

 

[tr][/tr][tr][/tr]
ASP set rstMain = Server.CreateObject("ADODB.Recordeset")

 

rstMain.Open strSQL,conexao

 

strSQL = "INSERT INTO resultado ( SG_UF, SG_MODALIDADE, NU_NL, DT_PUBLICAR, TE_ENTRADA, NM_STATUS, ID_EDITAL) " &_

" VALUES (' "& wuf &" ' , ' "& wmodal &" ' , ' "& wnl &" ' , ' "& wpublicar &" ' , ' " & wentrada &" ', ' " & wstatus &" ', ' " & wid_edital & " ')"

 

Joga a strSQL pra cima, tipo assim

 

[tr][/tr][tr][/tr]
ASP

strSQL = "INSERT INTO resultado ( SG_UF, SG_MODALIDADE, NU_NL, DT_PUBLICAR, TE_ENTRADA, NM_STATUS, ID_EDITAL) " &_

" VALUES (' "& wuf &" ' , ' "& wmodal &" ' , ' "& wnl &" ' , ' "& wpublicar &" ' , ' " & wentrada &" ', ' " & wstatus &" ', ' " & wid_edital & " ')"

 

set rstMain = Server.CreateObject("ADODB.Recordeset")

 

rstMain.Open strSQL,conexao

Compartilhar este post


Link para o post
Compartilhar em outros sites

qual o erro agora??

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.