rta歌曲:Working with date/time values
来源:百度文库 编辑:中财网 时间:2024/05/27 11:06:58
Home How To Online Documentation Support Download Order
Connecting to databases
Transactions
Executing an SQL command
Executing stored procedures
Binding input parameters
Fetching result set
Fetching multiple result sets
Optimizing Database Performance
Returning output parameters
Working with Long or Lob(CLob, BLob) Data
Working with date/time values
Error handling
Usingnative API
Query examples
Working with date/time values
Working with date/time values assumes the following:
into input variables (SQL statements) or input parameters(stored procedures/functions).
(from fields in result set or from output parameters ofstored procedure)
Binding date/time values
Suppose, we want to update date/time field named FDATETIMEfrom table named TEST ( Update TEST set FDATETIME = :1 )with the value of October 6, 2000 19:00:00.
As usual, the first thing to do is to create the objects.
SACommandcmd(&Connection, "Update TEST set FDATETIME = :1");
Next step is used to actually bind the date/time value intoinput variable:
SADateTime dtValue(
2000 /*year*/, 10 /*October*/, 6 /*day of month*/,
19 /*hours*/, 0 /*minutes*/, 0 /*seconds*/);
or (using C struct tm):
extern struct tm some_tm_Value;
SADateTime dtValue = some_tm_Value;
or (using Windows DATE data type):
extern DATE some_DATE_Value;
SADateTime dtValue = some_DATE_Value;
Next line binds date/time value.
cmd << dtValue;
All that we need now is to execute a query:
cmd.Execute();
Reading date/time values
Suppose, we want to retrieve date/time field named FDATETIMEfrom table named TEST (Select FDATETIME from TEST).
As usual, the first thing to do is to create the objects:
SACommandcmd(&Connection, "Select FDATETIME from TEST");
For more information seeConnecting todatabases.
Next thing to do is to execute a query:
cmd.Execute();
Next step is used to actually fetch the row and accessdate/time data:
if(cmd.FetchNext()) // or while(cmd.FetchNext())
{
SADateTime dtValue = cmd.Field("FDATETIME");
// access through standard C struct tm
struct tm tmValue = dtValue;
struct tm tmValue2 = (structtm)cmd.Field("FDATETIME").asDateTime();
...
// access through Windows DATE data type
DATE dateValue = dtValue;
DATE dateValue2 =(DATE)cmd.Field("FDATETIME").asDateTime();
...
}
Problems and Questions
If you haven't found the answer to your questions or have someproblems on using the Library, please, send e-mail tohowto@sqlapi.com.
Working with date/time values
Working with date/time values assumes the following:
into input variables (SQL statements) or input parameters(stored procedures/functions).
(from fields in result set or from output parameters ofstored procedure)
Binding date/time values
Suppose, we want to update date/time field named FDATETIMEfrom table named TEST ( Update TEST set FDATETIME = :1 )with the value of October 6, 2000 19:00:00.
As usual, the first thing to do is to create the objects.
SACommandcmd(&Connection, "Update TEST set FDATETIME = :1");
Next step is used to actually bind the date/time value intoinput variable:
SADateTime dtValue(
2000 /*year*/, 10 /*October*/, 6 /*day of month*/,
19 /*hours*/, 0 /*minutes*/, 0 /*seconds*/);
or (using C struct tm):
extern struct tm some_tm_Value;
SADateTime dtValue = some_tm_Value;
or (using Windows DATE data type):
extern DATE some_DATE_Value;
SADateTime dtValue = some_DATE_Value;
Next line binds date/time value.
cmd << dtValue;
All that we need now is to execute a query:
cmd.Execute();
Reading date/time values
Suppose, we want to retrieve date/time field named FDATETIMEfrom table named TEST (Select FDATETIME from TEST).
As usual, the first thing to do is to create the objects:
SACommandcmd(&Connection, "Select FDATETIME from TEST");
For more information seeConnecting todatabases.
Next thing to do is to execute a query:
cmd.Execute();
Next step is used to actually fetch the row and accessdate/time data:
if(cmd.FetchNext()) // or while(cmd.FetchNext())
{
SADateTime dtValue = cmd.Field("FDATETIME");
// access through standard C struct tm
struct tm tmValue = dtValue;
struct tm tmValue2 = (structtm)cmd.Field("FDATETIME").asDateTime();
...
// access through Windows DATE data type
DATE dateValue = dtValue;
DATE dateValue2 =(DATE)cmd.Field("FDATETIME").asDateTime();
...
}
Problems and Questions
If you haven't found the answer to your questions or have someproblems on using the Library, please, send e-mail tohowto@sqlapi.com.
I remember working with him last year.
Have a secret date with moisturizing sprayers
working "with" or "for" a magazine
Working Draft on Positioning HTML with Cascading Style Sheets
7228 GeForce4 Ti 4200 with AGP8X 显卡驱动``急
GeForce4 Ti 4200 with AGP8X支持directX 9.0吗?
NVIDIA GeForce4 Ti 4200 with AGP8X合适的驱动
The United States is committed to working with India to do this,是什么意思
He is working hard now with an eye ____ the future.
8 hours working with 1 hour break,总共是几个小时呀?
求《天使在人间》英语原版(date with an angel)
求助:service fee is due annually effective with the contract commencement date.怎么翻译?
It keeps you up to date on/with sth. 哪个对?
谁能给我 NVIDIA GeForce4 Ti 4200with AGP8X 的驱动
我的显卡是NVIDIA Geforce4 Ti 4200 with AGP8X怎么玩不了鬼武者3啊?
hard-working
Census Date
Creation Date
Inno3DGeForce2 Ti
16ti ~~~
下载的电影Date.With.An.Angel.1987.DVDRip.XviD-Shuangye.avi.bc!"请问用什么播放器播放,急
if one wants to see a doctor ,he fixes a date with him ahead of time.that is a common_in USA.
NVIDIA GeForce4 Ti 4200 with AGP8X哪个驱动玩3D游戏是最好的啊??我找了几个星期了5555
working in the sky