Trucsweb.com

Forum de discussion

 Forum « Programmation ASP » (archives)

saisie de données dans access

Envoyé: 18 janvier 2005, 6h54 par cmi11


j'utilise dreamweaver pour faire mes pages asp.
j'ai fait une page de saisie avec une connection odbc avec dsn sur le serveur, ça marche bien.
Maintenant je voudrais fair la même chose avec une connection sans dsn pour pouvoir exporter mon outil.
j'ai un message d'erreur qui me dit que j'ai une erreur de synthaxe. n° erreur 80040E14.
Cette erreur correspond à des problèmes de liaison avec la bd.
Mais lorsque j'utilise la connection avec dsn, je n'ai pas cette erreur.
Si tu as besoin du code de ma page, je le copie ci-dessous.

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="../../Connections/icen.asp" -->
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers=""
MM_authFailedURL="../erreur.htm"
MM_grantAccess=false
If Session("MM_Username") <> "" Then
If (true Or CStr(Session("MM_UserAuthorization"))="") Or _
(InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
MM_grantAccess = true
End If
End If
If Not MM_grantAccess Then
MM_qsChar = "?"
If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
MM_referrer = Request.ServerVariables("URL")
if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
Response.Redirect(MM_authFailedURL)
End If
%>
<%
' *** Edit Operations: declare variables

Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd

Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId

Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i

MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Request.QueryString
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables

If (CStr(Request("MM_insert")) = "form1") Then

MM_editConnection = MM_icen_STRING
MM_editTable = "tblCsp"
MM_editRedirectUrl = "visusaisie.asp"
MM_fieldsStr = "frp|value|ouverture|value|nomContribuable|value|lettre|value|AdresseContribuable|value|notif|value|CommuneContribuable|value|reponse|value|CodeNaf|value|taxation|value|oasisprincipal|value|NumSages|value|Annees|value|NumAgent|value|proc|value|NumSuite|value|montantAutres|value|nature|value|montantPenal|value|LiaisonCrit|value|montantIS|value|NumMotif|value|montantIR|value|NumCat|value|montantTP|value|montantTVA|value"
MM_columnsStr = "frp|none,none,NULL|ouverture|',none,NULL|nomContribuable|',none,''|lettre|',none,NULL|AdresseContribuable|',none,''|notif|',none,NULL|CommuneContribuable|',none,''|reponse|',none,NULL|CodeNaf|',none,''|taxation|',none,NULL|oasisPrincipal|',none,''|NumSages|none,none,NULL|Annees|',none,''|NumAgent|none,none,NULL|proc|',none,''|NumSuite|none,none,NULL|montantAutres|none,none,NULL|nature|',none,''|montantPenal|none,none,NULL|LiaisonCrit|none,Yes,No|montantIS|none,none,NULL|NumMotif|none,none,NULL|montantIR|none,none,NULL|NumCat|none,none,NULL|montantTP|none,none,NULL|montantTVA|none,none,NULL"

' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")

' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
Next

' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If

End If
%>

<%
' *** Insert Record: construct a sql insert statement and execute it

Dim MM_tableValues
Dim MM_dbValues

If (CStr(Request("MM_insert")) <> "") Then

' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),",")
MM_delim = MM_typeArray(0)
If (MM_delim = "none") Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none") Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none") Then MM_emptyVal = ""
If (MM_formVal = "") Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "") Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'") Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End If
MM_tableValues = MM_tableValues & MM_columns(MM_i)
MM_dbValues = MM_dbValues & MM_formVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"

If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close

If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl)
End If
End If

End If
%>
<%
Dim sages
Dim sages_numRows

Set sages = Server.CreateObject("ADODB.Recordset")
sages.ActiveConnection = MM_icen_STRING
sages.Source = "SELECT * FROM tblSages"
sages.CursorType = 0
sages.CursorLocation = 2
sages.LockType = 1
sages.Open()

sages_numRows = 0
%>
<%
Dim motif
Dim motif_numRows

Set motif = Server.CreateObject("ADODB.Recordset")
motif.ActiveConnection = MM_icen_STRING
motif.Source = "SELECT * FROM tblMotif"
motif.CursorType = 0
motif.CursorLocation = 2
motif.LockType = 1
motif.Open()

motif_numRows = 0
%>
<%
Dim agent
Dim agent_numRows

Set agent = Server.CreateObject("ADODB.Recordset")
agent.ActiveConnection = MM_icen_STRING
agent.Source = "SELECT * FROM tblAgent"
agent.CursorType = 0
agent.CursorLocation = 2
agent.LockType = 1
agent.Open()

agent_numRows = 0
%>
<%
Dim categ
Dim categ_numRows

Set categ = Server.CreateObject("ADODB.Recordset")
categ.ActiveConnection = MM_icen_STRING
categ.Source = "SELECT * FROM tblCategorie"
categ.CursorType = 0
categ.CursorLocation = 2
categ.LockType = 1
categ.Open()

categ_numRows = 0
%>
<%
Dim encore
Dim encore_numRows

Set encore = Server.CreateObject("ADODB.Recordset")
encore.ActiveConnection = MM_icen_STRING
encore.Source = "SELECT * FROM tblCsp"
encore.CursorType = 0
encore.CursorLocation = 2
encore.LockType = 1
encore.Open()

encore_numRows = 0
%>
<%
Dim rcssuit
Dim rcssuit_numRows

Set rcssuit = Server.CreateObject("ADODB.Recordset")
rcssuit.ActiveConnection = MM_icen_STRING
rcssuit.Source = "SELECT * FROM tblSuite"
rcssuit.CursorType = 0
rcssuit.CursorLocation = 2
rcssuit.LockType = 1
rcssuit.Open()

rcssuit_numRows = 0
%>
<html>
<head>
<title>Saisie des contrôles</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../../styles.css" rel="stylesheet" type="text/css">
<script language="javascript" src="../../js/twvalide.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">
var varValid = "frp,AdresseContribuable,CommuneContribuable,CodeNaf,Annees,LiaisonCrit,lettre,notif,reponse,taxation,oasisprincipal,proc,nature,NumSuite,NumMotif,NumAgent,NumCat,NumSages";

// LANGAGE PAR DÉFAUT
// Entrer "fr" pour français, rien pour englais.
var nlang = "fr"
// ********************************************
// -->
</script>
</head>

<body bgcolor="#66CCFF">
<p>
<SCRIPT language=JavaScript src="../../js/m_array5.js" type=text/javascript></SCRIPT>
<SCRIPT language=JavaScript src="../../js/mmenu.js" type=text/javascript></SCRIPT>

</p>
<p> </p>
<form method="POST" action="<%=MM_editAction%>" name="form1" onSubmit="return twValide(this);" >
<table width="49%" border="1" align="center" bordercolor="#000066" bgcolor="#A5A7EF">
<tr valign="baseline">
<td height="23" colspan="8" align="right" nowrap bgcolor="#B4DCFA"> <div align="center" class="pageSousTitre">Saisie
des contrôles </div></td>
</tr>
<tr valign="baseline">
<td colspan="2" align="right" nowrap bgcolor="#B4DCFA"><div align="center"><strong>Coordonnées
du contribuable</strong></div></td>
<td colspan="4" rowspan="6" bgcolor="#A5A7EF"> </td>
<td colspan="2" bgcolor="#B4DCFA"><div align="center"><strong>Saisie des
dates </strong></div></td>
</tr>
<tr valign="baseline">
<td width="153" align="right" nowrap bgcolor="#B4DCFA"> <div align="left">Frp:</div></td>
<td width="135" bgcolor="#A5A7EF"> <input type="text" name="frp" value="" size="23">
</td>
<td width="135" align="right" nowrap bgcolor="#B4DCFA"> <div align="left">Date
d'Ouverture:</div></td>
<td width="135" bgcolor="#A5A7EF"> <input name="ouverture" type="text" onBlur="twValide_date(this,1950,2020,'jj/mm/aaaa')" size="23" maxlength="10"></td>
</tr>
<tr valign="baseline">
<td width="153" align="right" nowrap bgcolor="#B4DCFA"> <div align="left">Nom
du Contribuable:</div></td>
<td width="135" bgcolor="#A5A7EF"> <input name="nomContribuable" type="text" size="23">
</td>
<td width="135" align="right" nowrap bgcolor="#B4DCFA"> <div align="left">Date
Lettre 754:</div></td>
<td width="135" bgcolor="#A5A7EF"> <input name="lettre" type="text" onBlur="twValide_date(this,1950,2020,'jj/mm/aaaa')" size="23" maxlength="10"></td>
</tr>
<tr valign="baseline">
<td width="153" align="right" nowrap bgcolor="#B4DCFA"> <div align="left">Adresse
du Contribuable:</div></td>
<td width="135" bgcolor="#A5A7EF"> <input type="text" name="AdresseContribuable" value="" size="23">
</td>
<td width="135" align="right" nowrap bgcolor="#B4DCFA"> <div align="left">Date
Notif 2120:</div></td>
<td width="135" bgcolor="#A5A7EF"> <input name="notif" type="text" onBlur="twValide_date(this,1950,2020,'jj/mm/aaaa')" size="23" maxlength="10"></td>
</tr>
<tr valign="baseline">
<td width="153" align="right" nowrap bgcolor="#B4DCFA"> <div align="left">Commune
du Contribuable:</div></td>
<td width="135" bgcolor="#A5A7EF"> <input type="text" name="CommuneContribuable" value="" size="23">
</td>
<td width="135" align="right" nowrap bgcolor="#B4DCFA"> <div align="left">Date
Reponse 3926:</div></td>
<td width="135" bgcolor="#A5A7EF"> <input name="reponse" type="text" onBlur="twValide_date(this,1950,2020,'jj/mm/aaaa')" size="23" maxlength="10"></td>
</tr>
<tr valign="baseline">
<td width="153" align="right" nowrap bgcolor="#B4DCFA"> <div align="left">CodeNaf:</div></td>
<td width="135" bgcolor="#A5A7EF"> <input type="text" name="CodeNaf" value="" size="23">
</td>
<td width="135" align="right" nowrap bgcolor="#B4DCFA"> <div align="left">Date
Taxation ou clôture:</div></td>
<td width="135" bgcolor="#A5A7EF"> <input name="taxation" type="text" onBlur="twValide_date(this,1950,2020,'jj/mm/aaaa')" size="23" maxlength="10"></td>
</tr>
<tr valign="baseline">
<td colspan="8" align="right" nowrap bgcolor="#B4DCFA">  </td>
</tr>
<tr valign="baseline">
<td colspan="2" align="right" nowrap bgcolor="#B4DCFA"> <div align="center" class="homeRubTitre">Critères
du dossier</div></td>
<td colspan="4" rowspan="10" bgcolor="#A5A7EF"> </td>
<td colspan="2" bgcolor="#B4DCFA"><div align="center">
<p class="homeRubTitre">Critères du service</p>
</div></td>
</tr>
<tr valign="baseline">
<td width="153" height="30" align="right" nowrap bgcolor="#B4DCFA"> <div align="left">Critère
Oasis:</div></td>
<td width="135" bgcolor="#A5A7EF"> <select name="oasisprincipal">
<option value="OASIS DIRCOFI" selected>OASIS DIRCOFI</option>
<option value="OASIS LOCAL">OASIS LOCAL</option>
<option value="AUTRE">AUTRE</option>
</select> </td>
<td width="135" bgcolor="#B4DCFA">Code Sages:</td>
<td width="135" bgcolor="#A5A7EF"> <select name="NumSages">
<%
While (NOT sages.EOF)
%>
<option value="<%=(sages.Fields.Item("NumSages").Value)%>"><%=(sages.Fields.Item("LibIfu").Value)%></option>
<%
sages.MoveNext()
Wend
If (sages.CursorType > 0) Then
sages.MoveFirst
Else
sages.Requery
End If
%>
</select></td>
</tr>
<tr valign="baseline">
<td width="153" align="right" nowrap bgcolor="#B4DCFA"> <div align="left">Annees
controlées:</div></td>
<td width="135" bgcolor="#A5A7EF"> <input type="text" name="Annees" value="" size="23">
</td>
<td width="135" bgcolor="#B4DCFA">Nom de l'Agent:</td>
<td width="135" bgcolor="#A5A7EF"> <select name="NumAgent">
<%
While (NOT agent.EOF)
%>
<option value="<%=(agent.Fields.Item("NumAgent").Value)%>"><%=(agent.Fields.Item("NomAgent").Value)%></option>
<%
agent.MoveNext()
Wend
If (agent.CursorType > 0) Then
agent.MoveFirst
Else
agent.Requery
End If
%>
</select></td>
</tr>
<tr valign="baseline">
<td width="153" align="right" nowrap bgcolor="#B4DCFA"> <div align="left">Procédures
:</div></td>
<td width="135" bgcolor="#A5A7EF"> <select name="proc">
<option value="PRC" selected>PRC</option>
<option value="TO">TO</option>
<option value="EO">EO</option>
<option value="AUTRE">AUTRE</option>
</select></td>
<td colspan="2" bgcolor="#B4DCFA"> <div align="center">
<p class="homeRubTitre">Montant redressés</p>
</div></td>
</tr>
<tr valign="baseline">
<td width="153" align="right" nowrap bgcolor="#B4DCFA"> <div align="left">Suites
:</div></td>
<td width="135" bgcolor="#CCCCCC"> <select name="NumSuite">
<%
While (NOT rcssuit.EOF)
%>
<option value="<%=(rcssuit.Fields.Item("NumSuite").Value)%>"><%=(rcssuit.Fields.Item("LibSuite").Value)%></option>
<%
rcssuit.MoveNext()
Wend
If (rcssuit.CursorType > 0) Then
rcssuit.MoveFirst
Else
rcssuit.Requery
End If
%>
</select> </td>
<td width="135" align="right" nowrap bgcolor="#B4DCFA"> <div align="left"><strong>Autres
: Droits</strong></div></td>
<td width="135" bgcolor="#A5A7EF"> <input type="text" name="montantAutres" value="0" onBlur="twValide_char(this,'0123456789',1)" align="right" size="23"></td>
</tr>
<tr valign="baseline">
<td width="153" align="right" nowrap bgcolor="#B4DCFA"> <div align="left">Nature:</div></td>
<td width="135" bgcolor="#A5A7EF"> <select name="nature" class="chemin">
<option value="OBLIGATOIRE" selected>OBLIGATOIRE</option>
<option value="PROGRAMME">PROGRAMME</option>
</select> </td>
<td width="135" align="right" nowrap bgcolor="#B4DCFA"> <div align="left">
<strong>Pénalités : </strong></div></td>
<td width="135" bgcolor="#A5A7EF"> <div align="right">
<input type="text" name="montantPenal" value="0" onBlur="twValide_char(this,'0123456789',1)" size="23">
</div></td>
</tr>
<tr valign="baseline">
<td width="153" align="right" nowrap bgcolor="#B4DCFA"> <div align="left">Pertinence
sélection :</div></td>
<td width="135" bgcolor="#A5A7EF"> <input type="checkbox" name="LiaisonCrit" value=1 >
</td>
<td width="135" align="right" nowrap bgcolor="#B4DCFA"> <div align="left">IS:
Droits redressés </div></td>
<td width="135" bgcolor="#A5A7EF"> <div align="right">
<input type="text" name="montantIS" value="0" onBlur="twValide_char(this,'0123456789',1)" size="23">
</div></td>
</tr>
<tr valign="baseline">
<td width="153" align="right" nowrap bgcolor="#B4DCFA"> <div align="left">Motif:</div></td>
<td width="135" bgcolor="#A5A7EF"> <select name="NumMotif" class="chemin">
<%
While (NOT motif.EOF)
%>
<option value="<%=(motif.Fields.Item("NumMotif").Value)%>"><%=(motif.Fields.Item("LibMotif").Value)%></option>
<%
motif.MoveNext()
Wend
If (motif.CursorType > 0) Then
motif.MoveFirst
Else
motif.Requery
End If
%>
</select> </td>
<td width="135" align="right" nowrap bgcolor="#B4DCFA"> <div align="left">IR:
Droits redressés</div></td>
<td width="135" bgcolor="#A5A7EF"> <div align="right">
<input type="text" name="montantIR" value="0" onBlur="twValide_char(this,'0123456789',1)" size="23">
</div></td>
</tr>
<tr valign="baseline">
<td width="153" align="right" nowrap bgcolor="#B4DCFA"> <div align="left">Catégorie:</div></td>
<td width="135" bgcolor="#A5A7EF"> <select name="NumCat">
<%
While (NOT categ.EOF)
%>
<option value="<%=(categ.Fields.Item("NumCat").Value)%>"><%=(categ.Fields.Item("LibCategorie").Value)%></option>
<%
categ.MoveNext()
Wend
If (categ.CursorType > 0) Then
categ.MoveFirst
Else
categ.Requery
End If
%>
</select> </td>
<td width="135" align="right" nowrap bgcolor="#B4DCFA"> <div align="left">TP:
Droits redressés</div></td>
<td width="135" bgcolor="#A5A7EF"> <div align="right">
<input type="text" name="montantTP" value="0" onBlur="twValide_char(this,'0123456789',1)" size="23">
</div></td>
</tr>
<tr valign="baseline">
<td width="153" align="right" nowrap bgcolor="#B4DCFA"> </td>
<td width="135" bgcolor="#A5A7EF">  </td>
<td width="135" align="right" nowrap bgcolor="#B4DCFA"> <div align="left">TVA:
Droits redressés</div></td>
<td width="135" bgcolor="#A5A7EF"> <div align="right">
<input type="text" name="montantTVA" value="0" onBlur="twValide_char(this,'0123456789',1)" size="23">
</div></td>
</tr>
<tr valign="baseline" bgcolor="#B4DCFA">
<td height="34" colspan="8" align="right" nowrap> <div align="center">
<input name="submit" type="submit" value="Insérer l'enregistrement">
</div></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1">
</form>
<p> </p>
<p> </p>
</body>
</html>
<%
sages.Close()
Set sages = Nothing
%>
<%
motif.Close()
Set motif = Nothing
%>
<%
agent.Close()
Set agent = Nothing
%>
<%
categ.Close()
Set categ = Nothing
%>
<%
encore.Close()
Set encore = Nothing
%>
<%
rcssuit.Close()
Set rcssuit = Nothing
%>



Code de ma connexion
<%
' FileName="Connection_ado_conn_string.htm"
' Type="ADO"
' DesigntimeType="ADO"
' HTTP="true"
' Catalog=""
' Schema=""
Dim MM_icen_STRING
MM_icen_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.mappath("/siteIce2/ice/gestion/ice2005.mdb")
%>



Réponses

 sp spRe: saisie de données dans access Oznog19/1/2005
Aucun médias sociaux
X

Trucsweb.com Connexion

Connexion

X

Trucsweb.com Mot de passe perdu

Connexion

X

Trucsweb.com Conditions générales

Conditions

Responsabilité

La responsabilité des Trucsweb.com ne pourra être engagée en cas de faits indépendants de sa volonté. Les informations mises à disposition sur ce site le sont uniquement à titre purement informatif et ne sauraient constituer en aucun cas un conseil ou une recommandation de quelque nature que ce soit.

Aucun contrôle n'est exercé sur les références et ressources externes, l'utilisateur reconnaît que les Trucsweb.com n'assume aucune responsabilité relative à la mise à disposition de ces ressources, et ne peut être tenue responsable quant à leur contenu.

Droit applicable et juridiction compétente

Les règles en matière de droit, applicables aux contenus et aux transmissions de données sur et autour du site, sont déterminées par la loi canadienne. En cas de litige, n'ayant pu faire l'objet d'un accord à l'amiable, seuls les tribunaux canadien sont compétents.

X

Trucsweb.com Trucsweb

X

Trucsweb.com Glossaire

X

Trucsweb.com Trucsweb

X

Trucsweb.com Trucsweb

Conditions

Aucun message!

Merci.

X
Aucun message!
X

Trucsweb.com Créer un compte

Créer un compte

.
@