By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,644 Members | 2,105 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,644 IT Pros & Developers. It's quick & easy.

Date in Sql in vb6

P: 2
Hello,

I have textbox for date input and retrieve it from table, but it always received error of invalid column for JUN if i enter 1/Jun/2006 using the DTPicker. Here is my code:

Dim d1,m1,y1,date1 as date
d1 = Day(text1.Text)
m1 = Month(text2.Text)
y1 = Year(text3.Text)
date1 = Format(d1 & "/" & m1 & "/" & y1", dd/MM/yyyy")

Is there something wrong with my code?Can anyone help? Thanks...
Dec 28 '07 #1
Share this Question
Share on Google+
2 Replies


debasisdas
Expert 5K+
P: 8,127
Since the error is invalid column check for the column name in the databae table and you are inserting value tot he proper column .

BTW what is the database you are using ?
Dec 28 '07 #2

VijaySofist
100+
P: 107
Hi!

Please Consider the following to avoid that Error.

Declare
Expand|Select|Wrap|Line Numbers
  1. Dim d1 as Day,m1 as Month,y1 as Year,date1 As Date
In your Code date1 = Format(d1 & "/" & m1 & "/" & y1", dd/MM/yyyy") double quotes was not placed properly

You can use this code
Expand|Select|Wrap|Line Numbers
  1. date1 = Format(d1 & "/" & m1 & "/" & "y1", "dd/MM/yyyy")
or

(
Expand|Select|Wrap|Line Numbers
  1. date1 = Format(d1 & "/" & m1 & "/" & "y1", "dd/MMM/yyyy")
This is because
In the DateTimePicker you choosed the Format dd/MMM/yyyy But while passing it to the variable you choosed the Format dd/MM/yyyy )

All The Best

With Regards
Vijay. R
Dec 28 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.