|
|
I have a feild of a SQL2000 DB set up as datetime, and I am trying to place a date into it as '11/4/2003'. The record gets inserted ok, but the date comes out as '1/1/1900'
Anyone care to gander as why?
|
|
|
|
|
I suppose your dateformat on the SQL server isnt 'd/m/yy' so it recognized it as 'something' but cant make a valid date out of it. So it gets inserted as 'empty' date which resolves to 1/1/1900.
I keep submitting “VB” as a Priority-1 bug, but apparently no one here knows how to fix it. Nick Hodapp, Semicolon
|
|
|
|
|
Tip:- to save confusion when using dates in MSSQLServer, always use the format like this:-
YYYY-MM-DD HH:MM:SS
eg
'2002-11-05'
or
'2002-11-05 16:35:00'
this really helps to eliminate date ordering oddness.
Signature space for rent. Apply by email to....
|
|
|
|
|
I close a database using:
database.OpenEx(mySql,CDatabase::noOdbcDialog) ...
...more code...
database.Close();
but it remains existing. I have read it is also needed to destroy the object,, how can I do it?
Thanks.
|
|
|
|
|
Set database = Nothing (in straight asp)
|
|
|
|
|
Well, it is an MFC app, this way:
void OnExcel(CString sExcelFile)//, CString ficheroSolo)
{
CDatabase database;
CString sDriver ;//= "MICROSOFT EXCEL DRIVER (*.XLS)";
sDriver = GetExcelDriver();
CString sSql;
TRY
{
// Build the creation string for access without DSN
sSql.Format("DRIVER={%s};DSN='';FIRSTROWHASNAMES=1;READONLY=FALSE;CREATE_DB=\"%s\";DBQ=%s", sDriver, sExcelFile, sExcelFile);
// Create the database (i.e. Excel sheet)
if( database.OpenEx(sSql,CDatabase::noOdbcDialog) )
{
// Create table structure
sSql.Format( "CREATE TABLE Graficas (Fecha TEXT, Hora NUMBER,[Temperatura (ºC)] NUMBER,[Rocío (ºC)] NUMBER,[Presión (mb)] NUMBER,[Velocidad (km/h)] NUMBER,[Dirección (º)] NUMBER,Brújula TEXT)");
database.ExecuteSQL(sSql);
}
...more code ...INSERT INTO, etc ....
database.Close();
|
|
|
|
|
When the your function ends, the CDatabase object is destroyed because it passes out of scope. There's no need to destroy it yourself, unless you created it with new , in which case you'll have to delete it.
|
|
|
|
|
Ok, ok. You're right. It was my mistake.
Thank you, very much.
|
|
|
|
|
How to do this using SQL-DMO? Subscriber and publisher status is needed.
I keep submitting “VB” as a Priority-1 bug, but apparently no one here knows how to fix it. Nick Hodapp, Semicolon
|
|
|
|
|
Hi all
I'm not sure what todo....I think I need a function...
This is my problem: I have a table called [References] with a [Rating] (tinyint) field. This field can be NULL or be 1,2,3,4,5 (stars ). Now what I wanna do is get an average of all non-NULL data where the [PersonID] (bigint) field equals a value from a SELECT query. OK I think I need to visualize
Table [References]:
[ID] bigint, (PK)
[PersonID] bigint,
[Rating] tinyint
Table [Users]:
[ID] bigint, (PK)
[Name] varchar(50),
[Role] int
Now I want the data to displayed as follows:
Output Table:
[Users.Name],
[References.AvgRating] ??????
where say [Role] = x
AS you can see I'm clueless but please help me
Cheers
"There are no stupid question's, just stupid people."
|
|
|
|