Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Iron Speed
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:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old August 23rd, 2003, 01: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, 01: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, 05: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!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

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





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway