|
Hi
I'm using access db and i want to get records that falls between spesific time period through VB. My sql does not work with time comparition.
..... WHERE sTime >= #8:30 AM# AND eTime < #10:30 AM#...
I also found that when i check the fields from VB, my time fields in DB do not show time but dates...
Please help me to solve the problem..
Thanks
Leelanga
|
|
|
|
|
You can transfer time into minutes using DATEPART function and use this value
As example:
DATEPART(month, GETDATE())
syntax: DATEPART ( datepart , date )
datepart name or abbreviation:
hour - hh
minute - mi, n
second - ss, s
millisecond - ms
You can use it that way:
WHERE DATEPART ( mi, sTime ) +DATEPART ( hh, sTime ) *60
>= DATEPART ( mi, #8:30 AM#) +DATEPART ( hh, #8:30 AM#) *60
AND
DATEPART ( mi, eTime ) +DATEPART ( hh, eTime) *60
<
DATEPART ( mi, #10:30 AM#) +DATEPART ( hh, #10:30 AM#) *60
Not a beatiful code, but it's works.
Also, You can use user-defined function to increase readability.
Hope, this helps.
Happy coding, Alexey.
|
|
|
|
|
Thanx Alexey...it's grate, i didn't know that before
Leelanga
|
|
|
|
|
Is it ossible to pass table as parametr to stored procedure???
sql server 2000
------------------------------------
To study, study and only to study
|
|
|
|
|
I guess yes if will user only one text parameter that contais your table in an xml format then you can user sp_xml_preparedocument and openxml to read rows from your table being passes through SP parameters
|
|
|
|
|
Thanks, however i already solve this problem i use a global table.
------------------------------------
To study, study and only to study
|
|
|
|
|
hi all,
I am on my way building my 1st windows app...
and recently got stuck with dataset efficiency problem (fill() function)..
FYI my app will implement search feature with many different criteria, for example user will be able to search orders table by using combination of criterias (eg: orderID, order date etc).
the way I designed my data access atm is, everytime the search form loaded, I will fill the ds with all order data. and then using datagrid + dataview I ll filtered out the data depend on user criteria. However I am concerned with the fact that this will slowdown the loading time when working with huge order database.
If anyone know the efficient way to do this. I ve thought of possibility of requerying the database, so initially dataset is left empty and filled+cleared every time user do the search. But I dont think this is a good idea as well. :S
anyone with ideas? TIA
|
|
|
|
|
You should generally retrieve as little information from the server as possible. This will reduce the network bandwidth required between the database server and your application. It also means that SQL Server doesn't have to process as much data in order to satisfy your query. Also, remember that SQL Server is much more efficient at filtering a result set than the filtering in .NET - after all, that is a big part of SQL Server's purpose in life.
However, this is general advice and may not be applicable for your application. You should do some performance testing to see which works better. If your sample set of data while you are working on the development is too small you may get skewed results.
My: Blog | Photos | Next SQL Presentation
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
|
|
|
|
|
Hello all
I am making a client server application in which client will call system calls and send the information to server in VC++.
I want to store that information into database e.g Access using ADO( in VC++).
Plz guide me what should i do?
Do i have to do serialization of data?
e.g From client i have to send the the computer name and user name to server. how will i do this ?
how will i serialize data?
how will i use ADO? I am newbie plz be aptient with me and also tell me examples as well
Thanks a lot
|
|
|
|
|
Hello,
I have a problem building a query.
There is a Master table with fields.
ItemID[int][PK] Description1[text] Description2 [text]
1 "Any desc" "Any Desc"
2 " " " "
and then there is a child table.
ID[int] ItemID[int] CustomerID[int]
1 1 546
2 1 546
3 1 534
4 2 545
the two table are inner-joined with ItemID.
I want to getthe data from two, but The Items selected should't repeat i.e. should be grouped by ItemID.
I have problems in this bec Description fields are text in this case.
So can anyone help me in this ?
Looking forward to hearing from you.
The problem is that i want to get just the
Regards,
Asim
|
|
|
|
|
I don't know that I understand you correctly. You want to INNER JOIN the master and child table, but you don't want to repeat the ItemID (the join column) because it will return duplicate text columns? I am somewhat curious as to what format you want the data in. Performing joins tends to produce denormalised output and you cannot really get away from that.
The best way that I can think of is to do two queries, one to join the tables but not return the text columns, and another to return just the text columns.
My: Blog | Photos | Next SQL Presentation
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
|
|
|
|
|
Hi, I have create one database in sql server. In the database I create one table that have the field and appropriate datatype. But when I detach the database from the sql server and change the location of the data file, and reattach it agian to the database. All the field datatype become to char datatype with lenght of 10. I don't understand why it become like that? Dose anyone have any idea about that? And how to recover it to the orriginal table that make all field have the previous datatype???
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
What's the field type in the first place? Are you using SQL 2000?
|
|
|
|
|
Albert Pascual wrote:
Are you using SQL 2000?
Yes
Albert Pascual wrote:
What's the field type in the first place?
There are around 200 fields in my table. And during the time that I create the all field set to char with 10 lengh. And after that I try to change each data type of the field to match my requirement for my application. Some field contain bit , smallint , smalldatetime , nvachar ... But the first field is nvachar with 15 lengh. I'm sure that before I close the table i also save to the change that i have made to my table. Then I start to detach the database from SQL server then move the source file to other destination of my computer but still in the same drive C: . Then I start to Attach the database to SQL server, but when I open the table I found that all the field data type in the table become to char with 10 lengh. I don't understand about this change, Do you have any idea about that???
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
Hi,
I'm using an inner datagrid(Master\details), with item template columns.Its getting the data from the database. In that i've a column enterddate in which i'm getting the date in the format 12/26/2005 12:00:00 a.m by default. want to remove this 12:00:00 thing but not able to get it. have tried using the DataFormatString={0 } in the html part but not wrking out. kindly let me know if ny answers to this.
Thanks a lot,
Manasi
|
|
|
|
|
Does anyone have any experience with these? What are some best practices for using them? We're using them at work, but I've never seen anyone use them before. Does Microsoft have any good documentation on this?
Thanks,
Will
|
|
|
|
|
What is these that you are referring to?
bravo659
|
|
|
|
|
Hi,
I have just installed MS SQL 2005 Express for testing purpose but a unabe t gn.. what user id and passwrd should use?
Many Thanks,
Jassim Rahma
|
|
|
|
|
Isn't username sa, password blank the default ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Can you create a liked server in the MSDE version of SQL Server?
If so, are there any limitations linking to a MS Access database?
Thanks,
Michael
I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious.
Vince Lombardi (1913-1970)
|
|
|
|
|
hi can you tel me how to use the sessions in asp.net. see i have diff users. depending on the user i want to view the data using his code
|
|
|
|
|
|
Hi,
For using session, you can first add some kind of id e.g userid or something to the session and then retrieve the id from the session and depending on user id get the data.
e.g.
to add id to session,
string sUserID=session.add["UserId",userid];
and to retrieve id from the session,
string sUserId = Session["sUserID"].ToString();
all the best,
manasi
|
|
|
|
|
how can i use ping command in ASP.NET??????
|
|
|
|
|