Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old August 23rd, 2003, 02:09 AM
Ginzu3 Ginzu3 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 26 Ginzu3 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 34 m 47 sec
Reputation Power: 0
MySQL and ASP

I am trying to add a "dynamic" date to my MySQL DB. A user inputs a date in txtfield1 fills out the rest of the info...clicks "next".

"Next" brings them to a verify page (page 2) where they can essentially "preview" the goods.

If it looks good, they click finish (which takes them to page 3) and the junk gets thrown into the DB.

Here's my problem. From page 1 - page 2...the data seems to be flowing well enough. From screen page 2 - 3, the data flow works and prints out on screen -- the way it should.

HOWEVER...none of the date is being inputed into the DB.

Code below is from all 3 pages:

-------------Page 1 -----------------
<form name="frmInfo" id="frminfo" method="post" action="verify.asp">

<select name="month">
<select name="day">
<select name="year">
<select name="Hour">
<select name="minute">
<input type="submit" name="Submit" value="Submit Information" onclick="frmInfo.submit()"/>


blah blah blah....


--------------Page 2 ----------------
varMonth=request.form("month")
varDate=request.form("day") & ", " & request.form("year")
varTime=request.form("hour") & ":" & request.form("minute") & " " & request.form("ToD")
varEvent=request.form("event")
varDescription=request.form("description")


<form name="frmsubmit" id="submitevents" method="post" action="submitevents.asp">

<input name="txtDate" type="hidden" value= <% request.form("year") & "-" & request.form("month") & "-" & request.form("day") %> />
<input name="txtTime" type="hidden" value= <% response.write varTime %> />
<input name="txtEvent" type="hidden" value= <% response.write varEvent %> />
<input name="txtDescription" type="hidden" value= <% response.write varDescription %> />


etc....


--------------Page 3 -----------------

strDate=request.form("txtdate")
strTime=request.form("txtTime")
strEvent=request.form("txtevent")
strDescription=request.form("txtdescription")



Dim dbconn, strSQL
strSQL = "INSERT INTO tblevents (eventid, varDate, event, varTime, description) VALUES ("
strSQL = strSQL & "Null"
strSQL = strSQL & ", ' " & request.form("txtdate") & "', '"
strSQL = strSQL & request.form("strtime")& "', '"
strSQL = strSQL & request.form("strevent") & "', '"
strSQL = strSQL & request.form("strdescription") & "')"



Set dbconn = Server.CreateObject("ADODB.Connection")
connstr = "DSN=events; UID=iisuser; pwd="
dbconn.open connstr
dbconn.execute strSQL, connstr
dbconn.close
Set dbconn = nothing






I can't seem to find the problem. The only thing I can think of, is that I am not providing either the correct format for the date or special characters. When I do a record submission THROUGH MySQL, I get the following line....(but keep in mind that everything was static).

INSERT INTO tblevents (eventid, vardate, vartime, event, description) VALUES (NULL, '2003-08-23', '08:00 PM\r\n', 'nothing ', 'more to say either.\r\n')






I know it's a lot to swallow...but...Any thoughts?

Reply With Quote
  #2  
Old August 23rd, 2003, 02:16 AM
Ginzu3 Ginzu3 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 26 Ginzu3 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 34 m 47 sec
Reputation Power: 0
I would also like to mention I am aware of the request.form mistakes in the "Page 3" section. One last thing to mention, which I forogt...My dates show up in the DB, but only as 0000-00-00 which it's telling me, I am getting a connection to the thing.

Reply With Quote
  #3  
Old September 16th, 2003, 06:16 PM
K_SAJESH K_SAJESH is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 9 K_SAJESH User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hello,

If you are using MySQL then as far a VB is concerned I insert date using format function as below


strSQL = "INSERT INTO tblevents (eventid, varDate, event, varTime, description) VALUES ("
strSQL = strSQL & "Null"
strSQL = strSQL & ", '" & Format(request.form("txtdate"), "YYYYMMDD") & "', '"
strSQL = strSQL & request.form("strtime")& "', '"
strSQL = strSQL & request.form("strevent") & "', '"
strSQL = strSQL & request.form("strdescription") & "')"

because MySQL accepts date in the above format i.e. YYYYMMDD and I doubt if it accepts "Null" just check out about Null but I am sure about the Date format. Now if there is format provision in asp (as far as my logic is concerned it has to be there) you use the format and it will definetely work. 101% sure of it.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > MySQL and ASP


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek