|
Hi
I have problem here
i have a column DateTime in database
i want to insert time only in this column
but after i add the time i find the data in table is date with time
this conflict the data when i rowfilter the dataview by this column
how can i solve it
"comment: this is the code of DataView "
DV_Deatils.RowFilter = "Room_No='" + combo_Rooms.SelectedValue + "' and ExamDate='" + dtp_examdate.Value.ToString("D") + "'"+
" and ExamTime>='" + txt_time.Text + "' and ExamTimeTo<='"+txt_timeto.Text+"'";
MD_NADA
|
|
|
|
|
md_nada wrote: but after i add the time i find the data in table is date with time
This is because the fact that SQL doesnt has a datatype called time but DateTime.
What you can do is, in the design mode of your database table set the format as short time( or which ever suitable to you)
|
|
|
|
|
Manas Bhardwaj wrote: What you can do is, in the design mode of your database table set the format as short time( or which ever suitable to you)
The database isn't interested in the format of the DateTime. Setting some format only alters the way it is displayed. It will still store something for the date portion.
This means you still have to consider what date you are going to give it so that queries work as expected.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
Assuming this is MS Sql Server, there is no Time datatype, only DateTime. You just need to ignore the Date portion of the DateTime field you're interested in.
Rhys
"The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it"
They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance."
Terry Pratchett
|
|
|
|
|
Simply ignore the date part when you retrieve the value from the database.
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
Hi,
first of all, I hope you're validating the values of dtp_examdate, txt_time and txt_timeto before filtering your DataView.
There are few things you could try, and I'll be honest, I'm not sure if any of them is good.
1. You can place a hardcoded date value in the database, for example '2007-01-01' will always be the date part of your datetime field. Probably not a good idea, you'd still need to handle insert/update properly (by a trigger perhaps), and parse the time value when selected from the DB. I'd say too much overhead.
2. Perhaps better than 1: store the time value in separate tinyint fields, Hour, Minute, Second. I believe this way you can filter the data easily, you only need to combine the values to display the time properly.
Hope that helps
---
http://sprdsoft.cmar-net.org - We Sprd You Softly
Our site features contents and several images. All of this is very weird.
In the end, war is not about who's right, it's about who's left.
|
|
|
|
|
Hi!
In my program i receive a data through TCP socket and i put them into a dataset. How can i insert these values into a .sdf (pocket pc/compact framework) database. Is there a method other than using an INSERT command for every dataset row? Because using INSERT is too slow.
Thank you!
--------------------------------
visit: http://pmartike.deviantart.com/
|
|
|
|
|
I've found it usually isn't the INSERT that is slow it is the database roundtrips that are slow. If the framework supports it then you should batch a number of INSERTs into one Command and send them together.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
But how can i do this?
--------------------------------
visit: http://pmartike.deviantart.com/
|
|
|
|
|
SQL Server CE is in-process so the round-trip problem doesn't apply. The parser only accepts one statement per batch. The parser is appallingly slow and the query execution engine isn't much better. You actually get best performance by simply opening the tables directly (specify the table name for SqlCeCommand.CommandText and set SqlCeCommand.CommandType to CommandType.TableDirect ) and not using SQL at all (ironically).
In CF 1.0 you could read tables directly but not update them - you had to use INSERT queries and Prepare the command object to avoid the query compiler overhead. CF 2.0 has a SqlCeResultSet class which is back to the bad good old days of ADO Recordset - you can scroll back and forth with a client-side cursor, seek to specific values, update or delete existing rows and insert new rows.
|
|
|
|
|
Mike Dimmick wrote: SQL Server CE is in-process so the round-trip problem doesn't apply. The parser only accepts one statement per batch.
Ah, okay - I've never used it.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
For SQL Server 2005 Mobile Edition/SQL Server CE 3.1, with .NET Compact Framework 2.0, you can manipulate the tables directly (as it's an in-process database engine).
Open a SqlCeResultSet directly on the table you want to insert into. Use the CreateRecord method to get a SqlCeUpdatableRecord , which you set the properties of. Then use the resultset's Insert method to update the table. Reportedly, this is much faster than using any SQL INSERT query, even if you Prepare the command object.
In fact SQL Server CE is reportedly much faster if you manipulate tables directly and use the navigation methods on SqlCeResultSet or SqlCeDataReader than using any form of SQL. Only use a SELECT query when you want to do a complicated join.
You can open an updatable resultset directly on a table by doing:
using( SqlCeCommand cmd = new SqlCeCommand( "MyTable", conn ) )
{
cmd.CommandType = CommandType.TableDirect;
using( SqlCeResultSet rs =
cmd.ExecuteResultSet( ResultSetOptions.Updatable ) )
{
}
} Note that this is unique to SQL Server CE - you cannot open tables directly with the full SQL Server 2000 or 2005.
|
|
|
|
|
Thank you
I'll try it..
--------------------------------
visit: http://pmartike.deviantart.com/
|
|
|
|
|
|
Suppose the next code:
<StackPanel Orientation="Horizontal" Width="120" Height="30">
<Ellipse Fill="#FFBF5757" Stroke="#FF000000" />
</StackPanel>
How do I to make the ellipse the same width of the stackpanel?
<StackPanel Orientation="Horizontal" Width="120" Height="30" <b>x:Name="panel"></b>
<Ellipse Fill="#FFBF5757" Stroke="#FF000000" <b>Width={panel.Width}</b> />
</StackPanel>
I don't know how. Thanks for any help
Juan Pablo G.C.
Overrider Blog
|
|
|
|
|
If Ellipse is always supposed to be the same width as the StackPanel, get a handle on the Elipse node and use node.Parent to get at StackPanel.
Hogan
|
|
|
|
|
hi all
i just want to know
if i want a similar kind of calendar tool as asp.net has (in java script)
what should i do for that calendar ... few validations have to be done...
i saw in net what i found was tools are available saying calendar.js..
is tat only way or so ..
i found even ajax tool kit also...
but i am struggling ot add up to my project
if someone has got articles please do help me ...
|
|
|
|
|
for ajax controls see this
http://www.asp.net/
|
|
|
|
|
Hi Guys,
i am using codeSmith to develope website and have a problem:
I know that all the stored are generated automatic when using netTiers to generate. but i have a function search user stored like this:
Alter Procedure SearchUser
@searchKey varchar(500)
As
select u.*
from users u
where u.userID in
(
select fmem.userID
from dbo.FamilyMembers fmem
where fmem.famID in
(
select f.famID
from dbo.Families f
where f.famName like '%'+@searchKey+'%'
)
)
GO
Please help me how to assgin UserService execute this store without re-generate source code
Thuan
|
|
|
|
|
Weren't there any vendor KBs on this issue?
|
|
|
|
|
Hello EveryBody,
I am new in windows application,
I am not able to set the number of rows in listview.
I want to display only ten records at time.
Regards,
rahul saini
|
|
|
|
|
You need to do list yourself... There's no paging-like functionality in a listview....
|
|
|
|
|
Hi!
The number of rows in a ListView depends on the value of its VirtualMode property.
If you don't run the ListView in virtual mode (the default) then the number of rows is equal to the number of ListViewItems inside the Items collection.
If you're running in virtual mode, there's a special property VirtualListSize to hold the number of items in the ListView . Using the ListView in virtual mode is an advanced topic, though.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Hi,
my application has an update feature: after the user clicks an update-button, my program checks wheather there is a newer version on the server. If yes, it is downloaded with a temporary filename into the program-folder. Then a separate update-exe is started, which replaces the old program.exe with the newer one by deleting the old and renaming the new file.
The problem is, that in Vista (but also in older systems) the write access to the program-folder is restricted.
Do you have an idea how I could work around this restriction or what I could do to keep this fast update feature available to my customers? E.g. my ZoneAlarm also has such an update-feature although I don´t know how this works...
Thanks in advance
Alex
|
|
|
|
|