473,387 Members | 1,365 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

VB6 and ms SQL 2005 DATETIME

Morning,
Could'nt find a post / site that has addressed this issue and I
would be very surprised if I'm the first to find this.

I am currently having an issue passing a parameter via a stored procedure in
vb6 to SQL 2005 that is requiring a datetime format.

VB6 supports these separatly i.e. DATE, TIME were as VB.Net etc. support
this as DATETIME.

Is there any way I can get the date into the SQL 2005 database, not fused
about the time part as this would help being stored as 00:00:00.

What I've tried so far is:

strDate = Format(strDate, "yyyy-mm-dd 00:00:00")

but when passing through it details parameter not supported:

..Parameters.Append .CreateParameter("dteDate", adDate, adParamInput, ,
dteDate)

Any idea's?

Many thanks,

Dan
Aug 7 '06 #1
4 8754
In Loving Memory - http://www.vbsight.com/Remembrance.htm
"dan688" <da****@discussions.microsoft.comwrote in message
news:68**********************************@microsof t.com...
Morning,
Could'nt find a post / site that has addressed this issue and I
would be very surprised if I'm the first to find this.

I am currently having an issue passing a parameter via a stored procedure
in
vb6 to SQL 2005 that is requiring a datetime format.

VB6 supports these separatly i.e. DATE, TIME were as VB.Net etc. support
this as DATETIME.

Is there any way I can get the date into the SQL 2005 database, not fused
about the time part as this would help being stored as 00:00:00.

What I've tried so far is:

strDate = Format(strDate, "yyyy-mm-dd 00:00:00")

but when passing through it details parameter not supported:

.Parameters.Append .CreateParameter("dteDate", adDate, adParamInput, ,
dteDate)

Any idea's?

Many thanks,

Dan
When you use the Format$ function, you're converting the value to a string,
no matter what.

VB6 has separate Date/Time functions but that has nothing to do with the
Date data type. They're simply functions that extract either the Date or the
Time from a Date datatype. There's no way to store only a time or date in
the Date datatype.

Dim WhatEver As Date
WhatEver = Now ' This is the current date/time and is a true Date datatype.
that any database should accept.

WhatEver = #2006/08/07# is also a true Date data type.
WhatEver = "2006/08/07" is not. It's a string.
--
Ken Halter - MS-MVP-VB (visiting from VB6 world) - http://www.vbsight.com
Please keep all discussions in the groups..
Aug 7 '06 #2
Do you have any idea what I would pass the parameter type through as because
adDate is not valid!
Aug 7 '06 #3
"dan688" <da****@discussions.microsoft.comwrote in message
news:47**********************************@microsof t.com...
Do you have any idea what I would pass the parameter type through as
because
adDate is not valid!
'======
Private Sub Command1_Click()
Dim dt As Date

dt = Now
dt = CDate(Format$(dt, "yyyy-mm-dd"))

Debug.Print dt '<-- pass dt. this should contain only the date

End Sub
'======

--
Ken Halter - MS-MVP-VB (visiting from VB6 world) - http://www.vbsight.com
Please keep all discussions in the groups..
In Loving Memory - http://www.vbsight.com/Remembrance.htm
Aug 7 '06 #4
Dan,

I don't know if you are an (USA) American, than you can use DateTime
literals, try to avoid outside that world those and just use the New
datetime which is conform ISO.

Unlucky enough does the VB debugger (not the C# debugger) only represents
datetimes in USA American notation, while the internal format has nothing to
do with that.

Beside that is the *DateTime* in the Microsoft Access and Jet Servers not a
string but a value representing ticks in 1000/3 seconds. Therefore you never
can say that a date or a time is alone stored.

I hope this gives an idea

Cor
"dan688" <da****@discussions.microsoft.comschreef in bericht
news:47**********************************@microsof t.com...
Do you have any idea what I would pass the parameter type through as
because
adDate is not valid!

Aug 7 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: ABC | last post by:
How to initial the datetime variable as value to "01/01/2005 00:00:00"?
3
by: Larry Bertolini | last post by:
For some reason, I recall having read that SQL Server 2005 would support a datatype that represented date, but not time. (This would be useful for storing things like birthday, where you usually...
0
by: samtilden | last post by:
We have upgraded our web project to Visual Studio 2005 (from VS 2003) and are still interfacing with some legacy ASP code that we do not want to change. The problem is that the VS 2003 compiler...
0
by: samtilden | last post by:
We have upgraded our web project to Visual Studio 2005 (from VS 2003) and are still interfacing with some legacy ASP code that we do not want to change. The problem is that the VS 2003 compiler...
10
by: Henrik Dahl | last post by:
Hello! I have an xml schema which has a date typed attribute. I have used xsd.exe to create a class library for XmlSerializer. The result of XmlSerializer.Serialize(...) should be passed as the...
1
by: Ruth413 | last post by:
Hello - I am getting the these errors in my sql 2005 generated script. I am stuck with first error. Please help.... Msg 102, Level 15, State 1, Line 3 Incorrect syntax near '('. Msg 319,...
5
by: umeshj99 | last post by:
Hi! I am using SQL Server 2005 express edition as backend and Visual Basic 2005 express edition as frontend. This question is related to date comparison. SELECT IssueDate, Client, ...
1
by: umeshj99 | last post by:
Hi! I am using SQL Server 2005 express edition as backend and Visual Basic 2005 express edition as frontend. This question is related to date comparison. SELECT IssueDate, Client, ...
4
by: Steve | last post by:
Hi All I need to compare date times from 2 different states in Australia in a Program I have which determines which way to update SQl server 2005 tables based on the lastupdate (datetime field)...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.