ASP Code layout

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

I have a form set up with the following line(s) of code:

SQLstmt = SQLstmt & "'" & CustomerLastName & "',"

Can I change the "'" to be "*"

If when the customer fills ot the fom and they put an ' in it, it will not
submit because it appears that the ' is used as a form field seperator. Can
the * be used as a separator?

Mikeal
 
Thanks,

That should work. There would also actually be a time when someone might put
a double quote in a field they are filling out. Is there any why around this
possible problem? Right now if a single quote is used it errors out when
writing to the dbase. And would do the same if a double quote was used.
 
Well you'd have to validate the input and replace double with single and
single with double. This could be accomplished at the client with
JavaScript.

Honestly, I can't think of a case where a datum would need a double quote in
the middle can you?
 
Try:

CustomerLastName = Cstr(Replace(Request.Form("CustomerLastName"),"'", "''"))

SQLstmt = SQLstmt & "'" & CustomerLastName & "',"

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================
 
One more problem,

I am trying to add a timestamp from my form into my dbase. The code is a s
follows:

DIM Conn,strConn,SQLstmt,RS
set Conn = server.createobject("adodb.connection")
strConn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("/_test/test.mdb")
Conn.open strConn
SQLstmt = "INSERT INTO Customer_Information (
CustomerLastName,CustomerFirstName,Timestamp)"
SQLstmt = SQLstmt & " VALUES ("
SQLstmt = SQLstmt & "'" & CustomerLastName & "',"
SQLstmt = SQLstmt & "'" & CustomerFirstName & "',"
SQLstmt = SQLstmt & "'" & Timestamp & "'"
SQLstmt = SQLstmt & ")"
Set RS = conn.execute(SQLstmt)

When I have the Timestamp in there it gives me an error that says:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO
statement.
/private/form_confirmation_new.asp, line 838

But when I remove the Timestamp information it works fine.

The Timestamp is defined as:

<%
Timestamp = Now()
%>

Thanks,

Mikeal
 
What page are you setting the timestamp?

Have you tried assigning a different name?

What type of date/time field do you have set in the database?


--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================


Mike said:
One more problem,

I am trying to add a timestamp from my form into my dbase. The code is a s
follows:

DIM Conn,strConn,SQLstmt,RS
set Conn = server.createobject("adodb.connection")
strConn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("/_test/test.mdb")
Conn.open strConn
SQLstmt = "INSERT INTO Customer_Information (
CustomerLastName,CustomerFirstName,Timestamp)"
SQLstmt = SQLstmt & " VALUES ("
SQLstmt = SQLstmt & "'" & CustomerLastName & "',"
SQLstmt = SQLstmt & "'" & CustomerFirstName & "',"
SQLstmt = SQLstmt & "'" & Timestamp & "'"
SQLstmt = SQLstmt & ")"
Set RS = conn.execute(SQLstmt)

When I have the Timestamp in there it gives me an error that says:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO
statement.
/private/form_confirmation_new.asp, line 838

But when I remove the Timestamp information it works fine.

The Timestamp is defined as:

<%
Timestamp = Now()
%>

Thanks,

Mikeal


Mike said:
Thanks,

That should work. There would also actually be a time when someone might put
a double quote in a field they are filling out. Is there any why around this
possible problem? Right now if a single quote is used it errors out when
writing to the dbase. And would do the same if a double quote was used.



-------------------------------------------------------------------------- will
not
 
1 - I am setting the timestamp on the page just prior to the one. I did this
so that I could
display it easily on this page and to make sure that it is being passed
from page to page
like the other variables.

2 -Yes, I tried naming it CurDate

3 - It is set to 'Date/Time' with a General Date format


Thomas A. Rowe said:
What page are you setting the timestamp?

Have you tried assigning a different name?

What type of date/time field do you have set in the database?


--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================


Mike said:
One more problem,

I am trying to add a timestamp from my form into my dbase. The code is a s
follows:

DIM Conn,strConn,SQLstmt,RS
set Conn = server.createobject("adodb.connection")
strConn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("/_test/test.mdb")
Conn.open strConn
SQLstmt = "INSERT INTO Customer_Information (
CustomerLastName,CustomerFirstName,Timestamp)"
SQLstmt = SQLstmt & " VALUES ("
SQLstmt = SQLstmt & "'" & CustomerLastName & "',"
SQLstmt = SQLstmt & "'" & CustomerFirstName & "',"
SQLstmt = SQLstmt & "'" & Timestamp & "'"
SQLstmt = SQLstmt & ")"
Set RS = conn.execute(SQLstmt)

When I have the Timestamp in there it gives me an error that says:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO
statement.
/private/form_confirmation_new.asp, line 838

But when I remove the Timestamp information it works fine.

The Timestamp is defined as:

<%
Timestamp = Now()
%>

Thanks,

Mikeal


Mike said:
Thanks,

That should work. There would also actually be a time when someone
might
put
a double quote in a field they are filling out. Is there any why
around
this
possible problem? Right now if a single quote is used it errors out when
writing to the dbase. And would do the same if a double quote was used.

Hi Mike,

The single quote is being used to delineate the literal values. You can
replace it with a double quote, replacing it with a * will not work.

--
Mike -- FrontPage MVP '97-'02
http://www.websunlimited.com
FrontPage Add-ins Since '97 2003 / 2002 / 2000 Compatible

--------------------------------------------------------------------------
--
--------------------
If you think I'm doing a good job, let MS know at (e-mail address removed)

I have a form set up with the following line(s) of code:

SQLstmt = SQLstmt & "'" & CustomerLastName & "',"

Can I change the "'" to be "*"

If when the customer fills ot the fom and they put an ' in it, it will
not
submit because it appears that the ' is used as a form field seperator.
Can
the * be used as a separator?

Mikeal
 
I got it one step further....

It now is giving me a data type mismatch error when it tries to write the
info. I cannot, for the life of me, figure out the format that the dbase
needs to be set to.

Any seguestions?


Thomas A. Rowe said:
How are you then passing the value between pages?

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================


Mike said:
1 - I am setting the timestamp on the page just prior to the one. I did this
so that I could
display it easily on this page and to make sure that it is being passed
from page to page
like the other variables.

2 -Yes, I tried naming it CurDate

3 - It is set to 'Date/Time' with a General Date format
is
a
s
follows:

DIM Conn,strConn,SQLstmt,RS
set Conn = server.createobject("adodb.connection")
strConn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("/_test/test.mdb")
Conn.open strConn
SQLstmt = "INSERT INTO Customer_Information (
CustomerLastName,CustomerFirstName,Timestamp)"
SQLstmt = SQLstmt & " VALUES ("
SQLstmt = SQLstmt & "'" & CustomerLastName & "',"
SQLstmt = SQLstmt & "'" & CustomerFirstName & "',"
SQLstmt = SQLstmt & "'" & Timestamp & "'"
SQLstmt = SQLstmt & ")"
Set RS = conn.execute(SQLstmt)

When I have the Timestamp in there it gives me an error that says:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO
statement.
/private/form_confirmation_new.asp, line 838

But when I remove the Timestamp information it works fine.

The Timestamp is defined as:

<%
Timestamp = Now()
%>

Thanks,

Mikeal


Thanks,

That should work. There would also actually be a time when someone might
put
a double quote in a field they are filling out. Is there any why around
this
possible problem? Right now if a single quote is used it errors out
when
writing to the dbase. And would do the same if a double quote was used.

Hi Mike,

The single quote is being used to delineate the literal values. You
can
replace it with a double quote, replacing it with a * will not work.

--
Mike -- FrontPage MVP '97-'02
http://www.websunlimited.com
FrontPage Add-ins Since '97 2003 / 2002 / 2000 Compatible

--------------------------------------------------------------------------
--
--------------------
If you think I'm doing a good job, let MS know at (e-mail address removed)

I have a form set up with the following line(s) of code:

SQLstmt = SQLstmt & "'" & CustomerLastName & "',"

Can I change the "'" to be "*"

If when the customer fills ot the fom and they put an ' in it, it
will
not
submit because it appears that the ' is used as a form field
seperator.
Can
the * be used as a separator?

Mikeal
 
Try

Date() instead of Now()

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================


Mike said:
I got it one step further....

It now is giving me a data type mismatch error when it tries to write the
info. I cannot, for the life of me, figure out the format that the dbase
needs to be set to.

Any seguestions?


Thomas A. Rowe said:
How are you then passing the value between pages?

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================
To assist you in getting the best answers for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp

did
this
code
is
a
s
follows:

DIM Conn,strConn,SQLstmt,RS
set Conn = server.createobject("adodb.connection")
strConn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("/_test/test.mdb")
Conn.open strConn
SQLstmt = "INSERT INTO Customer_Information (
CustomerLastName,CustomerFirstName,Timestamp)"
SQLstmt = SQLstmt & " VALUES ("
SQLstmt = SQLstmt & "'" & CustomerLastName & "',"
SQLstmt = SQLstmt & "'" & CustomerFirstName & "',"
SQLstmt = SQLstmt & "'" & Timestamp & "'"
SQLstmt = SQLstmt & ")"
Set RS = conn.execute(SQLstmt)

When I have the Timestamp in there it gives me an error that says:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO
statement.
/private/form_confirmation_new.asp, line 838

But when I remove the Timestamp information it works fine.

The Timestamp is defined as:

<%
Timestamp = Now()
%>

Thanks,

Mikeal


Thanks,

That should work. There would also actually be a time when someone
might
put
a double quote in a field they are filling out. Is there any why
around
this
possible problem? Right now if a single quote is used it errors out
when
writing to the dbase. And would do the same if a double quote was
used.

Hi Mike,

The single quote is being used to delineate the literal
values.
You
can
replace it with a double quote, replacing it with a * will not work.

--
Mike -- FrontPage MVP '97-'02
http://www.websunlimited.com
FrontPage Add-ins Since '97 2003 / 2002 / 2000 Compatible

--------------------------------------------------------------------------
--
--------------------
If you think I'm doing a good job, let MS know at
(e-mail address removed)

I have a form set up with the following line(s) of code:

SQLstmt = SQLstmt & "'" & CustomerLastName & "',"

Can I change the "'" to be "*"

If when the customer fills ot the fom and they put an ' in
it,
it
will
not
submit because it appears that the ' is used as a form field
seperator.
Can
the * be used as a separator?

Mikeal
 
I just did, with no luck.


Thomas A. Rowe said:
Try

Date() instead of Now()

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================


Mike said:
I got it one step further....

It now is giving me a data type mismatch error when it tries to write the
info. I cannot, for the life of me, figure out the format that the dbase
needs to be set to.

Any seguestions?


Thomas A. Rowe said:
How are you then passing the value between pages?

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================
To assist you in getting the best answers for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp

1 - I am setting the timestamp on the page just prior to the one. I did
this
so that I could
display it easily on this page and to make sure that it is being
passed
from page to page
like the other variables.

2 -Yes, I tried naming it CurDate

3 - It is set to 'Date/Time' with a General Date format


What page are you setting the timestamp?

Have you tried assigning a different name?

What type of date/time field do you have set in the database?


--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================
To assist you in getting the best answers for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp

One more problem,

I am trying to add a timestamp from my form into my dbase. The
code
is
a
s
follows:

DIM Conn,strConn,SQLstmt,RS
set Conn = server.createobject("adodb.connection")
strConn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("/_test/test.mdb")
Conn.open strConn
SQLstmt = "INSERT INTO Customer_Information (
CustomerLastName,CustomerFirstName,Timestamp)"
SQLstmt = SQLstmt & " VALUES ("
SQLstmt = SQLstmt & "'" & CustomerLastName & "',"
SQLstmt = SQLstmt & "'" & CustomerFirstName & "',"
SQLstmt = SQLstmt & "'" & Timestamp & "'"
SQLstmt = SQLstmt & ")"
Set RS = conn.execute(SQLstmt)

When I have the Timestamp in there it gives me an error that says:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error in
INSERT
INTO
statement.
/private/form_confirmation_new.asp, line 838

But when I remove the Timestamp information it works fine.

The Timestamp is defined as:

<%
Timestamp = Now()
%>

Thanks,

Mikeal


Thanks,

That should work. There would also actually be a time when someone
might
put
a double quote in a field they are filling out. Is there any why
around
this
possible problem? Right now if a single quote is used it
errors
out
when
writing to the dbase. And would do the same if a double quote was
used.

Hi Mike,

The single quote is being used to delineate the literal values.
You
can
replace it with a double quote, replacing it with a * will not
work.

--
Mike -- FrontPage MVP '97-'02
http://www.websunlimited.com
FrontPage Add-ins Since '97 2003 / 2002 / 2000 Compatible

--------------------------------------------------------------------------
--
--------------------
If you think I'm doing a good job, let MS know at
(e-mail address removed)

I have a form set up with the following line(s) of code:

SQLstmt = SQLstmt & "'" & CustomerLastName & "',"

Can I change the "'" to be "*"

If when the customer fills ot the fom and they put an ' in it,
it
will
not
submit because it appears that the ' is used as a form field
seperator.
Can
the * be used as a separator?

Mikeal
 
Thomas,

I just tested something.....

I displayed the Date?time on my screen ( response.write CurDate ) and
that worked fine. i then flaged the dbase to not allow a zero length string.
and when I submitted the form it gave me an error that the CurDate cannot be
zero length. Why would the date be working by displaying it on the screen
but it erases it when it is submitted.

Mikeal


Thomas A. Rowe said:
Try

Date() instead of Now()

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================


Mike said:
I got it one step further....

It now is giving me a data type mismatch error when it tries to write the
info. I cannot, for the life of me, figure out the format that the dbase
needs to be set to.

Any seguestions?


Thomas A. Rowe said:
How are you then passing the value between pages?

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================
To assist you in getting the best answers for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp

1 - I am setting the timestamp on the page just prior to the one. I did
this
so that I could
display it easily on this page and to make sure that it is being
passed
from page to page
like the other variables.

2 -Yes, I tried naming it CurDate

3 - It is set to 'Date/Time' with a General Date format


What page are you setting the timestamp?

Have you tried assigning a different name?

What type of date/time field do you have set in the database?


--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================
To assist you in getting the best answers for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp

One more problem,

I am trying to add a timestamp from my form into my dbase. The
code
is
a
s
follows:

DIM Conn,strConn,SQLstmt,RS
set Conn = server.createobject("adodb.connection")
strConn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("/_test/test.mdb")
Conn.open strConn
SQLstmt = "INSERT INTO Customer_Information (
CustomerLastName,CustomerFirstName,Timestamp)"
SQLstmt = SQLstmt & " VALUES ("
SQLstmt = SQLstmt & "'" & CustomerLastName & "',"
SQLstmt = SQLstmt & "'" & CustomerFirstName & "',"
SQLstmt = SQLstmt & "'" & Timestamp & "'"
SQLstmt = SQLstmt & ")"
Set RS = conn.execute(SQLstmt)

When I have the Timestamp in there it gives me an error that says:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error in
INSERT
INTO
statement.
/private/form_confirmation_new.asp, line 838

But when I remove the Timestamp information it works fine.

The Timestamp is defined as:

<%
Timestamp = Now()
%>

Thanks,

Mikeal


Thanks,

That should work. There would also actually be a time when someone
might
put
a double quote in a field they are filling out. Is there any why
around
this
possible problem? Right now if a single quote is used it
errors
out
when
writing to the dbase. And would do the same if a double quote was
used.

Hi Mike,

The single quote is being used to delineate the literal values.
You
can
replace it with a double quote, replacing it with a * will not
work.

--
Mike -- FrontPage MVP '97-'02
http://www.websunlimited.com
FrontPage Add-ins Since '97 2003 / 2002 / 2000 Compatible

--------------------------------------------------------------------------
--
--------------------
If you think I'm doing a good job, let MS know at
(e-mail address removed)

I have a form set up with the following line(s) of code:

SQLstmt = SQLstmt & "'" & CustomerLastName & "',"

Can I change the "'" to be "*"

If when the customer fills ot the fom and they put an ' in it,
it
will
not
submit because it appears that the ' is used as a form field
seperator.
Can
the * be used as a separator?

Mikeal
 
How are you passing the value of CurDate to your update query?

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================


Mike said:
Thomas,

I just tested something.....

I displayed the Date?time on my screen ( response.write CurDate ) and
that worked fine. i then flaged the dbase to not allow a zero length string.
and when I submitted the form it gave me an error that the CurDate cannot be
zero length. Why would the date be working by displaying it on the screen
but it erases it when it is submitted.

Mikeal


Thomas A. Rowe said:
Try

Date() instead of Now()

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================
To assist you in getting the best answers for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp

Mike said:
I got it one step further....

It now is giving me a data type mismatch error when it tries to write the
info. I cannot, for the life of me, figure out the format that the dbase
needs to be set to.

Any seguestions?


How are you then passing the value between pages?

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================
To assist you in getting the best answers for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp

1 - I am setting the timestamp on the page just prior to the one.
I
did
this
so that I could
display it easily on this page and to make sure that it is being
passed
from page to page
like the other variables.

2 -Yes, I tried naming it CurDate

3 - It is set to 'Date/Time' with a General Date format


What page are you setting the timestamp?

Have you tried assigning a different name?

What type of date/time field do you have set in the database?


--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================
To assist you in getting the best answers for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp

One more problem,

I am trying to add a timestamp from my form into my dbase. The code
is
a
s
follows:

DIM Conn,strConn,SQLstmt,RS
set Conn = server.createobject("adodb.connection")
strConn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("/_test/test.mdb")
Conn.open strConn
SQLstmt = "INSERT INTO Customer_Information (
CustomerLastName,CustomerFirstName,Timestamp)"
SQLstmt = SQLstmt & " VALUES ("
SQLstmt = SQLstmt & "'" & CustomerLastName & "',"
SQLstmt = SQLstmt & "'" & CustomerFirstName & "',"
SQLstmt = SQLstmt & "'" & Timestamp & "'"
SQLstmt = SQLstmt & ")"
Set RS = conn.execute(SQLstmt)

When I have the Timestamp in there it gives me an error that says:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT
INTO
statement.
/private/form_confirmation_new.asp, line 838

But when I remove the Timestamp information it works fine.

The Timestamp is defined as:

<%
Timestamp = Now()
%>

Thanks,

Mikeal


Thanks,

That should work. There would also actually be a time when someone
might
put
a double quote in a field they are filling out. Is there any why
around
this
possible problem? Right now if a single quote is used it errors
out
when
writing to the dbase. And would do the same if a double
quote
was
used.

Hi Mike,

The single quote is being used to delineate the literal values.
You
can
replace it with a double quote, replacing it with a * will not
work.

--
Mike -- FrontPage MVP '97-'02
http://www.websunlimited.com
FrontPage Add-ins Since '97 2003 / 2002 / 2000 Compatible

--------------------------------------------------------------------------
--
--------------------
If you think I'm doing a good job, let MS know at
(e-mail address removed)

I have a form set up with the following line(s) of code:

SQLstmt = SQLstmt & "'" & CustomerLastName & "',"

Can I change the "'" to be "*"

If when the customer fills ot the fom and they put an '
in
it,
it
will
not
submit because it appears that the ' is used as a form field
seperator.
Can
the * be used as a separator?

Mikeal
 
Mike said:
One more problem,

I am trying to add a timestamp from my form into my dbase. The code is a s
follows:

DIM Conn,strConn,SQLstmt,RS
set Conn = server.createobject("adodb.connection")
strConn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("/_test/test.mdb")
Conn.open strConn
SQLstmt = "INSERT INTO Customer_Information (
CustomerLastName,CustomerFirstName,Timestamp)"
SQLstmt = SQLstmt & " VALUES ("
SQLstmt = SQLstmt & "'" & CustomerLastName & "',"
SQLstmt = SQLstmt & "'" & CustomerFirstName & "',"
SQLstmt = SQLstmt & "'" & Timestamp & "'"
SQLstmt = SQLstmt & ")"
Set RS = conn.execute(SQLstmt)

When I have the Timestamp in there it gives me an error that says:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO
statement.
/private/form_confirmation_new.asp, line 838

But when I remove the Timestamp information it works fine.

I bet that in the database, you've got timestamp defined as a
Date/Time field. If so, change
SQLstmt = SQLstmt & "'" & Timestamp & "'"
to
SQLstmt = SQLstmt & "#" & Timestamp & "#"

In Access, you must enclose date values in pound signs, as you would
in Visual Basic.

Jim Buyens
Microsoft FrontPage MVP
(e-mail address removed)
http://www.interlacken.com
Author of:
*------------------------------------------------------*
|\----------------------------------------------------/|
|| Microsoft Office FrontPage 2003 Inside Out ||
|| Microsoft FrontPage Version 2002 Inside Out ||
|| Web Database Development Step by Step .NET Edition ||
|| Troubleshooting Microsoft FrontPage 2002 ||
|| Faster Smarter Beginning Programming ||
|| (All from Microsoft Press) ||
|/----------------------------------------------------\|
*------------------------------------------------------*
 
Jim,

I never had to do that when doing an insert or update, only when retrieving
records based on date/time.

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================


Jim Buyens said:
"Mike" <[email protected]> wrote in message
One more problem,

I am trying to add a timestamp from my form into my dbase. The code is a s
follows:

DIM Conn,strConn,SQLstmt,RS
set Conn = server.createobject("adodb.connection")
strConn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("/_test/test.mdb")
Conn.open strConn
SQLstmt = "INSERT INTO Customer_Information (
CustomerLastName,CustomerFirstName,Timestamp)"
SQLstmt = SQLstmt & " VALUES ("
SQLstmt = SQLstmt & "'" & CustomerLastName & "',"
SQLstmt = SQLstmt & "'" & CustomerFirstName & "',"
SQLstmt = SQLstmt & "'" & Timestamp & "'"
SQLstmt = SQLstmt & ")"
Set RS = conn.execute(SQLstmt)

When I have the Timestamp in there it gives me an error that says:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO
statement.
/private/form_confirmation_new.asp, line 838

But when I remove the Timestamp information it works fine.

I bet that in the database, you've got timestamp defined as a
Date/Time field. If so, change
SQLstmt = SQLstmt & "'" & Timestamp & "'"
to
SQLstmt = SQLstmt & "#" & Timestamp & "#"

In Access, you must enclose date values in pound signs, as you would
in Visual Basic.

Jim Buyens
Microsoft FrontPage MVP
(e-mail address removed)
http://www.interlacken.com
Author of:
*------------------------------------------------------*
|\----------------------------------------------------/|
|| Microsoft Office FrontPage 2003 Inside Out ||
|| Microsoft FrontPage Version 2002 Inside Out ||
|| Web Database Development Step by Step .NET Edition ||
|| Troubleshooting Microsoft FrontPage 2002 ||
|| Faster Smarter Beginning Programming ||
|| (All from Microsoft Press) ||
|/----------------------------------------------------\|
*------------------------------------------------------*
 
In ANY SQL Statement, when referring to a date-time value, in Access, the
date-time value must be enclosed in "#" characters.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Complex things are made up of
lots of simple things.

Thomas A. Rowe said:
Jim,

I never had to do that when doing an insert or update, only when retrieving
records based on date/time.

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================


Jim Buyens said:
"Mike" <[email protected]> wrote in message
a
s
follows:

DIM Conn,strConn,SQLstmt,RS
set Conn = server.createobject("adodb.connection")
strConn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("/_test/test.mdb")
Conn.open strConn
SQLstmt = "INSERT INTO Customer_Information (
CustomerLastName,CustomerFirstName,Timestamp)"
SQLstmt = SQLstmt & " VALUES ("
SQLstmt = SQLstmt & "'" & CustomerLastName & "',"
SQLstmt = SQLstmt & "'" & CustomerFirstName & "',"
SQLstmt = SQLstmt & "'" & Timestamp & "'"
SQLstmt = SQLstmt & ")"
Set RS = conn.execute(SQLstmt)

When I have the Timestamp in there it gives me an error that says:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO
statement.
/private/form_confirmation_new.asp, line 838

But when I remove the Timestamp information it works fine.

I bet that in the database, you've got timestamp defined as a
Date/Time field. If so, change
SQLstmt = SQLstmt & "'" & Timestamp & "'"
to
SQLstmt = SQLstmt & "#" & Timestamp & "#"

In Access, you must enclose date values in pound signs, as you would
in Visual Basic.

Jim Buyens
Microsoft FrontPage MVP
(e-mail address removed)
http://www.interlacken.com
Author of:
*------------------------------------------------------*
|\----------------------------------------------------/|
|| Microsoft Office FrontPage 2003 Inside Out ||
|| Microsoft FrontPage Version 2002 Inside Out ||
|| Web Database Development Step by Step .NET Edition ||
|| Troubleshooting Microsoft FrontPage 2002 ||
|| Faster Smarter Beginning Programming ||
|| (All from Microsoft Press) ||
|/----------------------------------------------------\|
*------------------------------------------------------*
 
Jim,

I put the # like you said and it now gives me the following error:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error in date in query
expression '##'.

Any sugestions?

Mike

Jim Buyens said:
"Mike" <[email protected]> wrote in message
One more problem,

I am trying to add a timestamp from my form into my dbase. The code is a s
follows:

DIM Conn,strConn,SQLstmt,RS
set Conn = server.createobject("adodb.connection")
strConn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("/_test/test.mdb")
Conn.open strConn
SQLstmt = "INSERT INTO Customer_Information (
CustomerLastName,CustomerFirstName,Timestamp)"
SQLstmt = SQLstmt & " VALUES ("
SQLstmt = SQLstmt & "'" & CustomerLastName & "',"
SQLstmt = SQLstmt & "'" & CustomerFirstName & "',"
SQLstmt = SQLstmt & "'" & Timestamp & "'"
SQLstmt = SQLstmt & ")"
Set RS = conn.execute(SQLstmt)

When I have the Timestamp in there it gives me an error that says:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO
statement.
/private/form_confirmation_new.asp, line 838

But when I remove the Timestamp information it works fine.

I bet that in the database, you've got timestamp defined as a
Date/Time field. If so, change
SQLstmt = SQLstmt & "'" & Timestamp & "'"
to
SQLstmt = SQLstmt & "#" & Timestamp & "#"

In Access, you must enclose date values in pound signs, as you would
in Visual Basic.

Jim Buyens
Microsoft FrontPage MVP
(e-mail address removed)
http://www.interlacken.com
Author of:
*------------------------------------------------------*
|\----------------------------------------------------/|
|| Microsoft Office FrontPage 2003 Inside Out ||
|| Microsoft FrontPage Version 2002 Inside Out ||
|| Web Database Development Step by Step .NET Edition ||
|| Troubleshooting Microsoft FrontPage 2002 ||
|| Faster Smarter Beginning Programming ||
|| (All from Microsoft Press) ||
|/----------------------------------------------------\|
*------------------------------------------------------*
 
Two "#" characters with nothing in between is not a date. You have to make
sure that a date value is entered.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Complex things are made up of
lots of simple things.

Mike said:
Jim,

I put the # like you said and it now gives me the following error:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error in date in query
expression '##'.

Any sugestions?

Mike

Jim Buyens said:
"Mike" <[email protected]> wrote in message
a
s
follows:

DIM Conn,strConn,SQLstmt,RS
set Conn = server.createobject("adodb.connection")
strConn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("/_test/test.mdb")
Conn.open strConn
SQLstmt = "INSERT INTO Customer_Information (
CustomerLastName,CustomerFirstName,Timestamp)"
SQLstmt = SQLstmt & " VALUES ("
SQLstmt = SQLstmt & "'" & CustomerLastName & "',"
SQLstmt = SQLstmt & "'" & CustomerFirstName & "',"
SQLstmt = SQLstmt & "'" & Timestamp & "'"
SQLstmt = SQLstmt & ")"
Set RS = conn.execute(SQLstmt)

When I have the Timestamp in there it gives me an error that says:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO
statement.
/private/form_confirmation_new.asp, line 838

But when I remove the Timestamp information it works fine.

I bet that in the database, you've got timestamp defined as a
Date/Time field. If so, change
SQLstmt = SQLstmt & "'" & Timestamp & "'"
to
SQLstmt = SQLstmt & "#" & Timestamp & "#"

In Access, you must enclose date values in pound signs, as you would
in Visual Basic.

Jim Buyens
Microsoft FrontPage MVP
(e-mail address removed)
http://www.interlacken.com
Author of:
*------------------------------------------------------*
|\----------------------------------------------------/|
|| Microsoft Office FrontPage 2003 Inside Out ||
|| Microsoft FrontPage Version 2002 Inside Out ||
|| Web Database Development Step by Step .NET Edition ||
|| Troubleshooting Microsoft FrontPage 2002 ||
|| Faster Smarter Beginning Programming ||
|| (All from Microsoft Press) ||
|/----------------------------------------------------\|
*------------------------------------------------------*
 
Thomas A. Rowe said:
Sorry, no it doesn't when doing Insert and Updates:

Well, well. I tried the following code and it worked regardless of
whether the date was enclosed by apostrophes and pound signs. The
effdate field was definitely a Date/Time field in Access.

Please buy yourself a refreshing carbonated beverage from me.

<%
dim conDb
dim cmdEmp
dim strConDb
dim strSql
dim recsaff
Set conDb = server.createobject("ADODB.Connection")
strConDb = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
server.mappath("fpdb/data.mdb") & ";"
conDb.Open strConDb
Set cmdEmp = server.createobject("ADODB.Command")
Set cmdEmp.ActiveConnection = conDb
strSql = "INSERT INTO empnames (effdate, empname) VALUES
('01-Feb-2003', 'Jim')"
cmdEmp.CommandText = strSql
cmdEmp.CommandType = adCmdText
cmdEmp.CommandTimeout = 15
cmdEmp.execute recsaff
response.write "<p>" & recsaff & " record(s) inserted.</p>"
conDb.close
%>

Jim Buyens
Microsoft FrontPage MVP
(e-mail address removed)
http://www.interlacken.com
Author of:
*------------------------------------------------------*
|\----------------------------------------------------/|
|| Microsoft Office FrontPage 2003 Inside Out ||
|| Microsoft FrontPage Version 2002 Inside Out ||
|| Web Database Development Step by Step .NET Edition ||
|| Troubleshooting Microsoft FrontPage 2002 ||
|| Faster Smarter Beginning Programming ||
|| (All from Microsoft Press) ||
|/----------------------------------------------------\|
*------------------------------------------------------*
 
Great and thanks for the drink!

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================
 
Back
Top