Error in inserting record via asp
Error in inserting record via asp
am 26.04.2005 21:30:02 von jack
Hi,
I got a asp page where I need insert record to a access table.
However, after running the page the following error is coming:
Error Type:
ADODB.Command (0x800A0E7C)
Parameter object is improperly defined. Inconsistent or incomplete
information was provided.
/gwisbrandnewready8/test2/AddDeleteExpense1.asp, line 99
The line 99 is: cmd.Execute ,arParms,129
Any help is appreciated.
CODE:
<%@ Language="VBScript"%>
<%
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
%>
<%
strTitle = "Simulate Add Delete Datasheet in ASP"
%>
<% =strTitle %>
Simulate Add Delete Datasheet in ASP
id="AddDeleteExpense" name="AddDeleteExpense">
<%
' Create a record set object
Dim dbPubs
Dim rsExpenses1
Dim strConn
Dim sql
Dim strFile
Dim fPerformUpdate
Dim strUpdated
Set cnnPubs = Server.CreateObject("ADODB.Connection")
Set rsExpenses1 = Server.CreateObject("ADODB.Recordset")
' MS Access Login Connection String
strFile = "Pubs.mdb"
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;"
strConn = strConn & "Data
Source=C:\z_z_z_z_z_ToHaveTableOutPutInTextBoxes\Pubs.mdb"
' Open Connection
cnnPubs.Open strConn
intCount = 0
TransactionID=Request.Form("ID_0")
sEno=Request.Form("eno_0")
sEntryDate=Request.Form("entrydate_0")
sContractedServiceExpense =Request.Form("contractedserviceexpense_0")
sTravelExpense=Request.Form("travelexpense_0")
sPersonnelExpense=Request.Form("personnelexpense_0")
Response.Write "ENO:" & sEno & "
"
Response.Write "EntryDate:" & sEntryDate & "
"
Response.Write "Contracted Service Expense: " & sContractedServiceExpense
& "
"
Response.Write "Travel Expense:" & sTravelExpense & "
"
Response.Write "Personnel Expense:" & sPersonnelExpense & "
"
' Create the UPDATE SQL Statement
sql = " INSERT INTO tblExpense " & _
"(eno, entrydate, contractedserviceexpense, travelexpense,
personnelexpense)" & _
"VALUES(?,?,?,?,?)"
arParms = array(sEno, sEntryDate, sContractedServiceExpense,
sTravelExpense, sPersonnelExpense)
Set cmd = createobject("adodb.command")
cmd.CommandText = sql
set cmd.ActiveConnection = cnnPubs
cmd.Execute ,arParms,129
intCount=1
' Now, loop through all the other records, looking
If intCount>0 then
strUpdated = "Record Process Successful. Total of
"
strUpdated = strUpdated & intCount & " records
affected."
Else
strUpdated = "No Records Processed"
End if
' Any pending UPDATES have been applied in the code above.
' Now, the Expenses1 table may be loaded afresh
sql = "SELECT * FROM tblExpense "
rsExpenses1.Open sql, cnnPubs
If rsExpenses1.BOF And rsExpenses1.EOF Then
%>
No Records Found For Expenses1
<%
ELSE
' Records Exist. Build our Datasheet
'
' First row is dedicated to the SAVE Button
' Next row is for Column Headers
%>
Re: Error in inserting record via asp
am 26.04.2005 22:40:05 von reb01501
Jack wrote:
> Hi,
> I got a asp page where I need insert record to a access table.
> However, after running the page the following error is coming:
>
> Error Type:
> ADODB.Command (0x800A0E7C)
> Parameter object is improperly defined. Inconsistent or incomplete
> information was provided.
> /gwisbrandnewready8/test2/AddDeleteExpense1.asp, line 99
>
> The line 99 is: cmd.Execute ,arParms,129
>
> Any help is appreciated.
>
> CODE:
> ' Create a record set object
> Dim dbPubs
> Dim rsExpenses1
> Dim strConn
> Dim sql
> Dim strFile
> Dim fPerformUpdate
> Dim strUpdated
>
> Set cnnPubs = Server.CreateObject("ADODB.Connection")
> Set rsExpenses1 = Server.CreateObject("ADODB.Recordset")
>
>
>
> ' MS Access Login Connection String
> strFile = "Pubs.mdb"
> strConn = "Provider=Microsoft.Jet.OLEDB.4.0;"
> strConn = strConn & "Data
> Source=C:\z_z_z_z_z_ToHaveTableOutPutInTextBoxes\Pubs.mdb"
>
> ' Open Connection
> cnnPubs.Open strConn
>
> intCount = 0
>
>
> TransactionID=Request.Form("ID_0")
> sEno=Request.Form("eno_0")
> sEntryDate=Request.Form("entrydate_0")
>
>
>
> sContractedServiceExpense
> =Request.Form("contractedserviceexpense_0")
> sTravelExpense=Request.Form("travelexpense_0")
> sPersonnelExpense=Request.Form("personnelexpense_0")
>
>
> Response.Write "ENO:" & sEno & "
"
> Response.Write "EntryDate:" & sEntryDate & "
"
>
> Response.Write "Contracted Service Expense: " &
> sContractedServiceExpense & "
"
> Response.Write "Travel Expense:" & sTravelExpense & "
"
> Response.Write "Personnel Expense:" & sPersonnelExpense & "
"
Why not show us the result of the above writes? It's relevant.
> ' Create the UPDATE SQL Statement
:-) Actually, it's an INSERT statment ....
>
> sql = " INSERT INTO tblExpense " & _
> "(eno, entrydate, contractedserviceexpense, travelexpense,
> personnelexpense)" & _
> "VALUES(?,?,?,?,?)"
>
> arParms = array(sEno, sEntryDate, sContractedServiceExpense,
> sTravelExpense, sPersonnelExpense)
>
> Set cmd = createobject("adodb.command")
> cmd.CommandText = sql
>
> set cmd.ActiveConnection = cnnPubs
> cmd.Execute ,arParms,129
>
It's hard to troubleshoot without knowing your table structure (especially
the datatypes of your fields), but I suspect the entrydate is a date/time
field. You need to pass it a value whose datatype is date. To do that:
sEntryDate = CDate(sEntryDate)
arParms = array(sEno, sEntryDate, sContractedServiceExpense, _
sTravelExpense, sPersonnelExpense)
etc.
This is one of the reasons this technique is so resistant to hacking: it
forces you to pass the correct datatypes.
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Re: Error in inserting record via asp
am 26.04.2005 23:01:08 von jack
Thanks for the advise Bob. I am finally trying to move to your method. My
Access table structure is as follows:
ENO - text
EntryDate - text
ContractedServiceExpense - number
TravelExpense - number
PersonnelExpense - number
Assuming date is text field could you please help me on which part of code
is the problem. Regards.
"Bob Barrows [MVP]" wrote:
> Jack wrote:
> > Hi,
> > I got a asp page where I need insert record to a access table.
> > However, after running the page the following error is coming:
> >
> > Error Type:
> > ADODB.Command (0x800A0E7C)
> > Parameter object is improperly defined. Inconsistent or incomplete
> > information was provided.
> > /gwisbrandnewready8/test2/AddDeleteExpense1.asp, line 99
> >
> > The line 99 is: cmd.Execute ,arParms,129
> >
> > Any help is appreciated.
> >
> > CODE:
>
> > ' Create a record set object
> > Dim dbPubs
> > Dim rsExpenses1
> > Dim strConn
> > Dim sql
> > Dim strFile
> > Dim fPerformUpdate
> > Dim strUpdated
> >
> > Set cnnPubs = Server.CreateObject("ADODB.Connection")
> > Set rsExpenses1 = Server.CreateObject("ADODB.Recordset")
> >
> >
> >
> > ' MS Access Login Connection String
> > strFile = "Pubs.mdb"
> > strConn = "Provider=Microsoft.Jet.OLEDB.4.0;"
> > strConn = strConn & "Data
> > Source=C:\z_z_z_z_z_ToHaveTableOutPutInTextBoxes\Pubs.mdb"
> >
> > ' Open Connection
> > cnnPubs.Open strConn
> >
> > intCount = 0
> >
> >
> > TransactionID=Request.Form("ID_0")
> > sEno=Request.Form("eno_0")
> > sEntryDate=Request.Form("entrydate_0")
> >
> >
> >
> > sContractedServiceExpense
> > =Request.Form("contractedserviceexpense_0")
> > sTravelExpense=Request.Form("travelexpense_0")
> > sPersonnelExpense=Request.Form("personnelexpense_0")
> >
> >
> > Response.Write "ENO:" & sEno & "
"
> > Response.Write "EntryDate:" & sEntryDate & "
"
> >
> > Response.Write "Contracted Service Expense: " &
> > sContractedServiceExpense & "
"
> > Response.Write "Travel Expense:" & sTravelExpense & "
"
> > Response.Write "Personnel Expense:" & sPersonnelExpense & "
"
>
> Why not show us the result of the above writes? It's relevant.
>
>
> > ' Create the UPDATE SQL Statement
>
> :-) Actually, it's an INSERT statment ....
>
> >
> > sql = " INSERT INTO tblExpense " & _
> > "(eno, entrydate, contractedserviceexpense, travelexpense,
> > personnelexpense)" & _
> > "VALUES(?,?,?,?,?)"
> >
> > arParms = array(sEno, sEntryDate, sContractedServiceExpense,
> > sTravelExpense, sPersonnelExpense)
> >
> > Set cmd = createobject("adodb.command")
> > cmd.CommandText = sql
> >
> > set cmd.ActiveConnection = cnnPubs
> > cmd.Execute ,arParms,129
> >
>
> It's hard to troubleshoot without knowing your table structure (especially
> the datatypes of your fields), but I suspect the entrydate is a date/time
> field. You need to pass it a value whose datatype is date. To do that:
>
> sEntryDate = CDate(sEntryDate)
> arParms = array(sEno, sEntryDate, sContractedServiceExpense, _
> sTravelExpense, sPersonnelExpense)
>
> etc.
>
> This is one of the reasons this technique is so resistant to hacking: it
> forces you to pass the correct datatypes.
>
> Bob Barrows
>
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>
>
Re: Error in inserting record via asp
am 26.04.2005 23:19:36 von McKirahan
"Jack" wrote in message
news:2FA56060-1555-48DC-B62E-0E400CE064BB@microsoft.com...
> Hi,
> I got a asp page where I need insert record to a access table.
> However, after running the page the following error is coming:
>
> Error Type:
> ADODB.Command (0x800A0E7C)
> Parameter object is improperly defined. Inconsistent or incomplete
> information was provided.
> /gwisbrandnewready8/test2/AddDeleteExpense1.asp, line 99
>
> The line 99 is: cmd.Execute ,arParms,129
Not that you asked ....
Here's a rewrite of your code; watch for word-wrap.
I'm sure it doesn't work as-is but it should be easier to maintain.
"Option Explicit" is used to ensure all variables are declared.
CSS is used in place of tags and its structured better.
<%@ Language="VBScript"%>
<% Option Explicit
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
'*
'* Declare Constants
'*
Const cTitle = "Simulate Add Delete Datasheet in ASP"
Const cFile = "Pubs.mdb"
Const cConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
Const cData = "C:\z_z_z_z_z_ToHaveTableOutPutInTextBoxes\Pubs.mdb"
'*
'* Declare Variables
'*
Dim intCount
intCount = 0
Dim TransactionID
TransactionID = Request.Form("ID_0")
Dim sEno
sEno = Request.Form("eno_0")
Dim sEntryDate
sEntryDate = Request.Form("entrydate_0")
Dim sContractedServiceExpense
sContractedServiceExpense =
Request.Form("contractedserviceexpense_0")
Dim sTravelExpense
sTravelExpense = Request.Form("travelexpense_0")
Dim sPersonnelExpense
sPersonnelExpense = Request.Form("personnelexpense_0")
Dim sql
sql = "INSERT INTO tblExpense "
sql = sql & "(eno, entrydate, contractedserviceexpense,
travelexpense, personnelexpense) VALUES(?,?,?,?,?)"
Dim arParms
arParms = array(sEno, sEntryDate, sContractedServiceExpense,
sTravelExpense, sPersonnelExpense)
Dim strUpdated
Dim tid
'*
Response.Write "ENO:" & sEno & "
"
Response.Write "EntryDate:" & sEntryDate & "
"
Response.Write "Contracted Service Expense: " &
sContractedServiceExpense & "
"
Response.Write "Travel Expense:" & sTravelExpense & "
"
Response.Write "Personnel Expense:" & sPersonnelExpense & "
"
'*
'* Declare Objects
'*
Dim cnnPubs
Set cnnPubs = Server.CreateObject("ADODB.Connection")
cnnPubs.Open cConn & cData
Dim rsExpenses1
Set rsExpenses1 = Server.CreateObject("ADODB.Recordset")
'*
'* >>>>>>>>>> Not sure how this part is supposed to work! <<<<<<<<<<
'*
Dim cmd
Set cmd = createobject("adodb.command")
cmd.CommandText = sql
Set cmd.ActiveConnection = cnnPubs
cmd.Execute ,arParms,129
intCount=1
If intCount > 0 then
strUpdated = "Record Process Successful."
strUpdated = strUpdated & "Total of " &
intCount & " records affected."
Else
strUpdated = "No Records Processed"
End if
%>
<%=cTitle%>
Simulate Add Delete Datasheet in
ASP
name="AddDeleteExpense">
<% sql = "SELECT * FROM tblExpense "
rsExpenses1.Open sql, cnnPubs
If rsExpenses1.BOF And rsExpenses1.EOF Then
%>
No Records Found For Expenses1
<%
Else
%>
<% End If %>
<% '*
'* Destroy Objects
'*
Set cnnPubs = Nothing
Set rsExpenses1 = Nothing
%>
Re: Error in inserting record via asp
am 26.04.2005 23:40:06 von jack
McKirahan,
I really appreciate your time and effort to redo the code in the
best practise method. Thanks. I will take a look at it. I am still
waiting for response for the part that is not working.
Regards.
"McKirahan" wrote:
> "Jack" wrote in message
> news:2FA56060-1555-48DC-B62E-0E400CE064BB@microsoft.com...
> > Hi,
> > I got a asp page where I need insert record to a access table.
> > However, after running the page the following error is coming:
> >
> > Error Type:
> > ADODB.Command (0x800A0E7C)
> > Parameter object is improperly defined. Inconsistent or incomplete
> > information was provided.
> > /gwisbrandnewready8/test2/AddDeleteExpense1.asp, line 99
> >
> > The line 99 is: cmd.Execute ,arParms,129
>
>
> Not that you asked ....
>
> Here's a rewrite of your code; watch for word-wrap.
> I'm sure it doesn't work as-is but it should be easier to maintain.
>
> "Option Explicit" is used to ensure all variables are declared.
> CSS is used in place of tags and its structured better.
>
> <%@ Language="VBScript"%>
> <% Option Explicit
> Response.CacheControl = "no-cache"
> Response.AddHeader "Pragma", "no-cache"
> '*
> '* Declare Constants
> '*
> Const cTitle = "Simulate Add Delete Datasheet in ASP"
> Const cFile = "Pubs.mdb"
> Const cConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
> Const cData = "C:\z_z_z_z_z_ToHaveTableOutPutInTextBoxes\Pubs.mdb"
> '*
> '* Declare Variables
> '*
> Dim intCount
> intCount = 0
> Dim TransactionID
> TransactionID = Request.Form("ID_0")
> Dim sEno
> sEno = Request.Form("eno_0")
> Dim sEntryDate
> sEntryDate = Request.Form("entrydate_0")
> Dim sContractedServiceExpense
> sContractedServiceExpense =
> Request.Form("contractedserviceexpense_0")
> Dim sTravelExpense
> sTravelExpense = Request.Form("travelexpense_0")
> Dim sPersonnelExpense
> sPersonnelExpense = Request.Form("personnelexpense_0")
> Dim sql
> sql = "INSERT INTO tblExpense "
> sql = sql & "(eno, entrydate, contractedserviceexpense,
> travelexpense, personnelexpense) VALUES(?,?,?,?,?)"
> Dim arParms
> arParms = array(sEno, sEntryDate, sContractedServiceExpense,
> sTravelExpense, sPersonnelExpense)
> Dim strUpdated
> Dim tid
> '*
> Response.Write "ENO:" & sEno & "
"
> Response.Write "EntryDate:" & sEntryDate & "
"
> Response.Write "Contracted Service Expense: " &
> sContractedServiceExpense & "
"
> Response.Write "Travel Expense:" & sTravelExpense & "
"
> Response.Write "Personnel Expense:" & sPersonnelExpense & "
"
> '*
> '* Declare Objects
> '*
> Dim cnnPubs
> Set cnnPubs = Server.CreateObject("ADODB.Connection")
> cnnPubs.Open cConn & cData
> Dim rsExpenses1
> Set rsExpenses1 = Server.CreateObject("ADODB.Recordset")
> '*
> '* >>>>>>>>>> Not sure how this part is supposed to work! <<<<<<<<<<
> '*
> Dim cmd
> Set cmd = createobject("adodb.command")
> cmd.CommandText = sql
> Set cmd.ActiveConnection = cnnPubs
> cmd.Execute ,arParms,129
> intCount=1
> If intCount > 0 then
> strUpdated = "Record Process Successful."
> strUpdated = strUpdated & "Total of " &
> intCount & " records affected."
> Else
> strUpdated = "No Records Processed"
> End if
> %>
>
>
> <%=cTitle%>
>
>
>
>
>
>
>
Simulate Add Delete Datasheet in
> ASP
>
>
> name="AddDeleteExpense">
> <% sql = "SELECT * FROM tblExpense "
> rsExpenses1.Open sql, cnnPubs
> If rsExpenses1.BOF And rsExpenses1.EOF Then
> %>
> No Records Found For Expenses1
>
> <%
> Else
> %>
>
> <% End If %>
>
> <% '*
> '* Destroy Objects
> '*
> Set cnnPubs = Nothing
> Set rsExpenses1 = Nothing
> %>
>
>
>
>
>
Re: Error in inserting record via asp
am 26.04.2005 23:50:20 von reb01501
So what are the results of the Response.Writes?
Jack wrote:
> Thanks for the advise Bob. I am finally trying to move to your
> method. My Access table structure is as follows:
> ENO - text
> EntryDate - text
> ContractedServiceExpense - number
> TravelExpense - number
> PersonnelExpense - number
>
> Assuming date is text field could you please help me on which part of
> code is the problem. Regards.
>
> "Bob Barrows [MVP]" wrote:
>
>> Jack wrote:
>>> Hi,
>>> I got a asp page where I need insert record to a access table.
>>> However, after running the page the following error is coming:
>>>
>>> Error Type:
>>> ADODB.Command (0x800A0E7C)
>>> Parameter object is improperly defined. Inconsistent or incomplete
>>> information was provided.
>>> /gwisbrandnewready8/test2/AddDeleteExpense1.asp, line 99
>>>
>>> The line 99 is: cmd.Execute ,arParms,129
>>>
>>> Any help is appreciated.
>>>
>>> CODE:
>>
>>> ' Create a record set object
>>> Dim dbPubs
>>> Dim rsExpenses1
>>> Dim strConn
>>> Dim sql
>>> Dim strFile
>>> Dim fPerformUpdate
>>> Dim strUpdated
>>>
>>> Set cnnPubs = Server.CreateObject("ADODB.Connection")
>>> Set rsExpenses1 = Server.CreateObject("ADODB.Recordset")
>>>
>>>
>>>
>>> ' MS Access Login Connection String
>>> strFile = "Pubs.mdb"
>>> strConn = "Provider=Microsoft.Jet.OLEDB.4.0;"
>>> strConn = strConn & "Data
>>> Source=C:\z_z_z_z_z_ToHaveTableOutPutInTextBoxes\Pubs.mdb"
>>>
>>> ' Open Connection
>>> cnnPubs.Open strConn
>>>
>>> intCount = 0
>>>
>>>
>>> TransactionID=Request.Form("ID_0")
>>> sEno=Request.Form("eno_0")
>>> sEntryDate=Request.Form("entrydate_0")
>>>
>>>
>>>
>>> sContractedServiceExpense
>>> =Request.Form("contractedserviceexpense_0")
>>> sTravelExpense=Request.Form("travelexpense_0")
>>> sPersonnelExpense=Request.Form("personnelexpense_0")
>>>
>>>
>>> Response.Write "ENO:" & sEno & "
"
>>> Response.Write "EntryDate:" & sEntryDate & "
"
>>>
>>> Response.Write "Contracted Service Expense: " &
>>> sContractedServiceExpense & "
"
>>> Response.Write "Travel Expense:" & sTravelExpense & "
"
>>> Response.Write "Personnel Expense:" & sPersonnelExpense & "
"
>>
>> Why not show us the result of the above writes? It's relevant.
>>
>>
>>> ' Create the UPDATE SQL Statement
>>
>> :-) Actually, it's an INSERT statment ....
>>
>>>
>>> sql = " INSERT INTO tblExpense " & _
>>> "(eno, entrydate, contractedserviceexpense, travelexpense,
>>> personnelexpense)" & _
>>> "VALUES(?,?,?,?,?)"
>>>
>>> arParms = array(sEno, sEntryDate, sContractedServiceExpense,
>>> sTravelExpense, sPersonnelExpense)
>>>
>>> Set cmd = createobject("adodb.command")
>>> cmd.CommandText = sql
>>>
>>> set cmd.ActiveConnection = cnnPubs
>>> cmd.Execute ,arParms,129
>>>
>>
>> It's hard to troubleshoot without knowing your table structure
>> (especially the datatypes of your fields), but I suspect the
>> entrydate is a date/time field. You need to pass it a value whose
>> datatype is date. To do that:
>>
>> sEntryDate = CDate(sEntryDate)
>> arParms = array(sEno, sEntryDate, sContractedServiceExpense, _
>> sTravelExpense, sPersonnelExpense)
>>
>> etc.
>>
>> This is one of the reasons this technique is so resistant to
>> hacking: it forces you to pass the correct datatypes.
>>
>> Bob Barrows
>>
>> --
>> Microsoft MVP -- ASP/ASP.NET
>> Please reply to the newsgroup. The email account listed in my From
>> header is my spam trap, so I don't check it very often. You will get
>> a quicker response by posting to the newsgroup.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Re: Error in inserting record via asp
am 26.04.2005 23:56:19 von reb01501
Is there missing numeric data? If so, you need to pass Nulls (assuming your
fields aren't set up to be Required ... )
sContractedServiceExpense =Request.Form("contractedserviceexpense_0")
if len(sContractedServiceExpense) = 0 then
sContractedServiceExpense = Null
Else
sContractedServiceExpense=CSng(sContractedServiceExpense)
End if
Yes, it's more code to write, but when you are through, the code will be
more bulletproof.
Bob Barrows
Jack wrote:
> Thanks for the advise Bob. I am finally trying to move to your
> method. My Access table structure is as follows:
> ENO - text
> EntryDate - text
> ContractedServiceExpense - number
> TravelExpense - number
> PersonnelExpense - number
>
> Assuming date is text field could you please help me on which part of
> code is the problem. Regards.
>
> "Bob Barrows [MVP]" wrote:
>
>> Jack wrote:
>>> Hi,
>>> I got a asp page where I need insert record to a access table.
>>> However, after running the page the following error is coming:
>>>
>>> Error Type:
>>> ADODB.Command (0x800A0E7C)
>>> Parameter object is improperly defined. Inconsistent or incomplete
>>> information was provided.
>>> /gwisbrandnewready8/test2/AddDeleteExpense1.asp, line 99
>>>
>>> The line 99 is: cmd.Execute ,arParms,129
>>>
>>> Any help is appreciated.
>>>
>>> CODE:
>>
>>> ' Create a record set object
>>> Dim dbPubs
>>> Dim rsExpenses1
>>> Dim strConn
>>> Dim sql
>>> Dim strFile
>>> Dim fPerformUpdate
>>> Dim strUpdated
>>>
>>> Set cnnPubs = Server.CreateObject("ADODB.Connection")
>>> Set rsExpenses1 = Server.CreateObject("ADODB.Recordset")
>>>
>>>
>>>
>>> ' MS Access Login Connection String
>>> strFile = "Pubs.mdb"
>>> strConn = "Provider=Microsoft.Jet.OLEDB.4.0;"
>>> strConn = strConn & "Data
>>> Source=C:\z_z_z_z_z_ToHaveTableOutPutInTextBoxes\Pubs.mdb"
>>>
>>> ' Open Connection
>>> cnnPubs.Open strConn
>>>
>>> intCount = 0
>>>
>>>
>>> TransactionID=Request.Form("ID_0")
>>> sEno=Request.Form("eno_0")
>>> sEntryDate=Request.Form("entrydate_0")
>>>
>>>
>>>
>>> sContractedServiceExpense
>>> =Request.Form("contractedserviceexpense_0")
>>> sTravelExpense=Request.Form("travelexpense_0")
>>> sPersonnelExpense=Request.Form("personnelexpense_0")
>>>
>>>
>>> Response.Write "ENO:" & sEno & "
"
>>> Response.Write "EntryDate:" & sEntryDate & "
"
>>>
>>> Response.Write "Contracted Service Expense: " &
>>> sContractedServiceExpense & "
"
>>> Response.Write "Travel Expense:" & sTravelExpense & "
"
>>> Response.Write "Personnel Expense:" & sPersonnelExpense & "
"
>>
>> Why not show us the result of the above writes? It's relevant.
>>
>>
>>> ' Create the UPDATE SQL Statement
>>
>> :-) Actually, it's an INSERT statment ....
>>
>>>
>>> sql = " INSERT INTO tblExpense " & _
>>> "(eno, entrydate, contractedserviceexpense, travelexpense,
>>> personnelexpense)" & _
>>> "VALUES(?,?,?,?,?)"
>>>
>>> arParms = array(sEno, sEntryDate, sContractedServiceExpense,
>>> sTravelExpense, sPersonnelExpense)
>>>
>>> Set cmd = createobject("adodb.command")
>>> cmd.CommandText = sql
>>>
>>> set cmd.ActiveConnection = cnnPubs
>>> cmd.Execute ,arParms,129
>>>
>>
>> It's hard to troubleshoot without knowing your table structure
>> (especially the datatypes of your fields), but I suspect the
>> entrydate is a date/time field. You need to pass it a value whose
>> datatype is date. To do that:
>>
>> sEntryDate = CDate(sEntryDate)
>> arParms = array(sEno, sEntryDate, sContractedServiceExpense, _
>> sTravelExpense, sPersonnelExpense)
>>
>> etc.
>>
>> This is one of the reasons this technique is so resistant to
>> hacking: it forces you to pass the correct datatypes.
>>
>> Bob Barrows
>>
>> --
>> Microsoft MVP -- ASP/ASP.NET
>> Please reply to the newsgroup. The email account listed in my From
>> header is my spam trap, so I don't check it very often. You will get
>> a quicker response by posting to the newsgroup.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.