IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
VB Classic
Search VB Classic Group:

Advanced
-Collapse +Expand VB Classic Store

Prestwood eMagazine

October Edition
Subscribe now! It's Free!
Enter your email:

   ► MB LobbyVisual Basic Classic BoardVB Classic Database Tasks Topic   Print This    All Groups  

vb+mysql

vearn21
 (Inactive)
-- USA
hi..
just wanna ask about vb+mysql db.
i tried to update field that have datatype date but it not work.

dim mydate
dim mydate12 as date

mydate12=format(now,"yyyy-mm-dd")
'mydate12=2002-04-29

mydate=format(now,"yyyy-mm-dd")
'mydate = 2002-04-29

sql = "UPDATE customer SET date_keyin=" & mydate & "," & "user_name=" & "'ihan'"
sql = sql & " WHERE (id_no =" & txtID & " AND ref_no=" & "'" & txtNoRef & "')"
conn.Execute sql

i wanna update date_keyin field.
if i use mydate variable, it insert null value but when i use mydate12 it work but it insert value 2000-00-01.
why? how can i update the true date. using 'now' command. any suggestion?

thanx
 Posted 20 years ago (Thread Starter)
Comment Quote
About vearn21 -Collapse +Expand
Visit Profile
Inactive member.
Member does not subscribe to this thread.
Email Not Verified!
Once email is verified, we will review and approve the account.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #6022, 2 replies
Thread Started 4/29/2002 12:12:00 AM
View Counter=2367
Last Reply Posted 4/29/2002 9:58:00 PM)
Location=-- USA 
Joined=20 years ago   MB Posts=2  
jdschram
MN
i think your SQL is wrong, that is why you are having the trouble with the date...

try putting ' characters around the date so it would look like

SET date_keyin= '" & mydate & "',"

I beleive this is the syntax for MySQL
 Posted 20 years ago
Comment Quote
About jdschram -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #6034 (Level 1.1)  Reply to 6022
Thread Started 4/29/2002 11:35:00 AM
View Counter=2
Location=MN  
Joined=21 years ago   MB Posts=259  
Most Recent Post
vearn21
 (Inactive)
-- USA
hi..thanx..i already check it and it must have a "'" before the date field.


okeys..this error come when i insert new data into mysql db using myodbc connection.coz of this error i don't use myodbc.

run time error -2147217887
multiple step operation generate error.check each status value

this is my programme

Set rs = New Recordset
rs.CursorLocation = adUseClient
rs.Open "SELECT * FROM customer", conn, adOpenStatic, adLockOptimistic

rs.AddNew
rs!id_no = txtID
rs!ref_no = Trim(UCase(txtNoRef))
rs!cname = Trim(UCase(txtName))
rs!ic_new = txtICN
rs!ic_old = Trim(UCase(txtICO))
rs!bank = Trim(UCase(co_bank.Text))
rs!address1 = Trim(UCase(txtAdd1))
rs!address2 = Trim(UCase(txtAdd2))
rs!poscode = txtPos
rs!city = Trim(UCase(txtCt))
rs!State = Trim(UCase(co_negeri.Text))
rs!pincharge = Trim(UCase(co_incharge.Text))
rs!Type = Trim(UCase(txtType))
rs!Year = txtYear
rs!active = UCase(co_active.Text)
rs!remark = Trim(UCase(txtRemark))
rs!date_keyin = Now
rs!user_name = "me"
rs.update
rs.Close

each field has a value but the error mess told to check the value..maybe it because the datatype.

first it happen in rs!name field..and i change the fieldname to rs!cname.after that it happen at rs!pincharge field. i dont know why.
before this i insert new data..it's dont have any problem.it's happen only sometimes..maybe i make some mistake but i dont know what. any ideas?

thanx.
 Posted 20 years ago (Thread Starter)
Comment Quote
About vearn21 -Collapse +Expand
Visit Profile
Inactive member.
Member does not subscribe to this thread.
Email Not Verified!
Once email is verified, we will review and approve the account.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #6040 (Level 1.2)  Reply to 6022
Reply Posted 4/29/2002 9:58:00 PM
Location=-- USA 
Joined=20 years ago   MB Posts=2  

Revive Thread!

Add a comment to revive this old thread and make this archived thread more useful.

Write a Comment...
Full Editor
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P143A1
Enter key:
Icon: A Post    Thread    Idea    Important!    Cool    Sad    No    Yes    Includes a Link...   
Thread #6022 Counter
2367
Since 4/2/2008
Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site: 
www.prestwood.com


©1995-2022 Prestwood IT Solutions.   [Security & Privacy]