|
| |
|
|
malky800
Posts: 116 Joined: 1/11/2006 Status: offline
|
Calling a date - 2/6/2006 15:55:48
When my information gets sent to my database I would like it to also add the current date into a field in my database. Any suggestions?
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: Calling a date - 2/6/2006 15:57:16
If you can post your current query statement and which DB you're using, we can probably come up with it.
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
malky800
Posts: 116 Joined: 1/11/2006 Status: offline
|
RE: Calling a date - 2/8/2006 15:30:04
Currently I have it like this. I dim every variable and request.form except for the date Dim query query= "INSERT INTO Table1 (email, phone, question,date) SELECT '" + email + "','" +phone+ "','"+ question + "','" + date + "'" When I try to run the page I get an error page.
|
|
|
|
malky800
Posts: 116 Joined: 1/11/2006 Status: offline
|
RE: Calling a date - 2/13/2006 10:46:42
THe date doesn't return anything in my database?
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: Calling a date - 2/13/2006 10:52:52
quote:
question + "','" + date + "'" Try this: ...question + "','" + date() + "'" That help any?
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
malky800
Posts: 116 Joined: 1/11/2006 Status: offline
|
RE: Calling a date - 2/13/2006 15:41:12
I'm getting a type mismatch error. What format am i supposed to be set up in Access. Is it bringing down a short date type?
|
|
|
|
Spooky
Posts: 26606 Joined: 11/11/1998 From: Middle Earth Status: offline
|
RE: Calling a date - 2/13/2006 16:04:13
With Access youll use # as a delimiter query= "INSERT INTO Table1 (email, phone, question,[date]) SELECT '" &email& "','" &phone&"','"&question& "',#" & date() & "#" OR : query= "INSERT INTO Table1 (email, phone, question,[date]) SELECT '" &email& "','" &phone&"','"&question& "', now()"
_____________________________
If you arent part of the solution, then there is good money to be made prolonging the problem §þ k¥
|
|
|
|
malky800
Posts: 116 Joined: 1/11/2006 Status: offline
|
RE: Calling a date - 2/13/2006 16:18:18
let's just confirm what i have; a database with a field called date that is a short date field. in my asp script i dim a variable called date then i inserted a script like this query= "INSERT INTO Table1 (name1, email, question, [date]) SELECT '" + name1 + "','" + email + "','" + question + "','" + heard+ "','" + religion + "','"+ current+"','" +phone + "','"+ formType+ "',#" + date() + "#" + "'" This is the error i get when i try to run it. Microsoft VBScript runtime error '800a000d' Type mismatch /gotquestions1.asp, line 58
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: Calling a date - 2/13/2006 16:27:33
quote:
query= "INSERT INTO Table1 (name1, email, question, [date]) SELECT '" + name1 + "','" + email + "','" + question + "','" + heard+ "','" + religion + "','"+ current+"','" +phone + "','"+ formType+ "',#" + date() + "#" + "'" Change all your + to & like this: query= "INSERT INTO Table1 (name1, email, question, [date]) SELECT '" & name1 & "','" & email & "','" ....
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
malky800
Posts: 116 Joined: 1/11/2006 Status: offline
|
RE: Calling a date - 2/13/2006 16:38:49
OK, so now it looks like this. query= "INSERT INTO Table1 (name1, email, question, [date]) SELECT '" & name1 & "','" & email & "','" & question & "',#" & date() & "#" & "'" and it tried taking out the last quotations at the end query= "INSERT INTO Table1 (name1, email, question, [date]) SELECT '" & name1 & "','" & email & "','" & question & "',#" & date() & "#" & "'" Both don't work.
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: Calling a date - 2/13/2006 16:43:19
quote:
..."',#" & date() & "#" & "'" Should be just: ..."',#" & date() & "#"
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
malky800
Posts: 116 Joined: 1/11/2006 Status: offline
|
RE: Calling a date - 2/13/2006 16:48:12
Sorry, it doesn't work? Any other suggestions?
|
|
|
|
malky800
Posts: 116 Joined: 1/11/2006 Status: offline
|
RE: Calling a date - 2/13/2006 16:49:35
Can it be a problem with my access database field?
|
|
|
|
malky800
Posts: 116 Joined: 1/11/2006 Status: offline
|
RE: Calling a date - 2/13/2006 16:53:05
in access , when I try to make a query a get an error message "syntax error in string in query expression '#" & date& "#"
|
|
|
|
malky800
Posts: 116 Joined: 1/11/2006 Status: offline
|
RE: Calling a date - 2/14/2006 10:50:15
This is what is says in my browser: Microsoft VBScript runtime error '800a000d' Type mismatch /gotquestions1.asp, line 59 Is it possible, the problem is with my database fields?
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: Calling a date - 2/14/2006 10:52:48
quote:
Is it possible, the problem is with my database fields? Can't tell just yet. Did you put in those 2 lines I suggested so we can see the actual SQL you're sending to the Access DB?
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
malky800
Posts: 116 Joined: 1/11/2006 Status: offline
|
RE: Calling a date - 2/14/2006 11:17:37
yes, and i pasted the results here Microsoft VBScript runtime error '800a000d' Type mismatch /gotquestions1.asp, line 59
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: Calling a date - 2/14/2006 11:21:20
quote:
line 59 Sorry 'bout that. It looks like we're never even making it to the "query=" line. Which is line 59?
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
malky800
Posts: 116 Joined: 1/11/2006 Status: offline
|
RE: Calling a date - 2/14/2006 11:41:54
it's the query = ....
|
|
|
|
malky800
Posts: 116 Joined: 1/11/2006 Status: offline
|
RE: Calling a date - 2/14/2006 12:46:36
starting from where? until there? Is there an easy way to paste all my script like I see other users doing?
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: Calling a date - 2/14/2006 13:19:08
On the posting form, there is a little button that looks like <% and will put two forum tags that you can paste your complete page code between those two tags. That puts it in one of those scrolling windows.
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
malky800
Posts: 116 Joined: 1/11/2006 Status: offline
|
RE: Calling a date - 2/14/2006 13:43:28
<%@LANGUAGE="VBSCRIPT" %>
<!--#include file="Connections/commentConn.asp" -->
<%
Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd
Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Request.QueryString
End If
MM_abortEdit = false
MM_editQuery = ""
If (CStr(Request("MM_insert")) = "form1") Then
MM_editConnection = MM_commentConn_STRING
MM_editTable = "Table1"
MM_editRedirectUrl = "http://www.kars4kids.org/thankyoukids.htm"
End If
If (CStr(Request("MM_insert")) <> "") Then
Dim name1
dim email
dim question
dim date
name1 = (Request.Form("name1"))
email = (Request.Form("email"))
question = (Request.Form("question"))
Dim query
query="INSERT INTO Table1 (name1, email, question, [date]) VALUES ('" & name1 & "','" & email & "','" & question & "',#" & date() & "#)"
Response.write(query)
Response.end
%>
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: Calling a date - 2/14/2006 13:56:58
Is that all of it? It looks like there's more since there's only 50 lines there and you haven't closed this IF..THEN statement here: If (CStr(Request("MM_insert")) <> "") Then I would expect a different error. Are you sure that's the whole page? Is that page named "gotquestions1.asp"?
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
malky800
Posts: 116 Joined: 1/11/2006 Status: offline
|
RE: Calling a date - 2/14/2006 15:33:35
Sorry, I pulled a similiar code I'm trying to work with. I only included the code that pulls to the database, the rest of the page is where I send an auto-response email. it should be 51 lines anyway <%@LANGUAGE="VBSCRIPT" %>
<!--#include file="Connections/askRabbiConn.asp" -->
<%
Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd
Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Request.QueryString
End If
MM_abortEdit = false
MM_editQuery = ""
If (CStr(Request("MM_insert")) = "form1") Then
MM_editConnection = MM_askRabbiConn_STRING
MM_editTable = "Table1"
MM_editRedirectUrl = "http://www.gottorah.org/thankyoukids.htm"
End If
If (CStr(Request("MM_insert")) <> "") Then
Dim name1
dim email
dim question
dim date
name1 = (Request.Form("name1"))
email = (Request.Form("email"))
question = (Request.Form("question"))
Dim query
query="INSERT INTO Table1 (name1, email, question, [date]) VALUES ('" & name1 & "','" & email & "','" & question & "',#" & date() & "#)"
Response.write(query)
Response.end
If (Not MM_abortEdit) Then
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = query
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl)
End If
End If
End If
%> and the new error is Microsoft VBScript runtime error '800a000d'
Type mismatch
/gotquestions23.asp, line 44
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: Calling a date - 2/14/2006 15:59:04
One thing I would try at this point is forcing strings into your variables like this: name1 = trim(Request.Form("name1")&"") email = trim((Request.Form("email")&"") question = trim((Request.Form("question")&"") That should force all of those fields into empty strings if they are null. That help at all?
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
malky800
Posts: 116 Joined: 1/11/2006 Status: offline
|
RE: Calling a date - 2/14/2006 16:08:36
Nope, still the same type mismatch error.
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: Calling a date - 2/14/2006 16:12:21
quote:
query="INSERT INTO Table1 (name1, email, question, [date]) VALUES ('" & name1 & "','" & email & "','" & question & "',#" & date() & "#)" Can you hard code that query for a test? query="INSERT INTO Table1 (name1, email, question, [date]) VALUES ('Test','Test@testdomain.com','My Question',#01/01/2001#)" Does that error?
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|