|
I am reading an Excel file into a dataset, then later into an Access table. All being done using C#. The first thing I do is load a dataset with the Excel data. There is a column in the Excel file called SEQNUM, and the corresponding Access column's name is the same. It's a DateTime field. The data in the Excel file appears to be a datetime.
When I look at the dataset with the DataSet Viewer, the data in the SEQNUM column looks like this:
-7017917/858993439/08
-7017918/858993451/08
3/-29/34
3/-28/34
1/-429496757/35
-20/-429496747/37
-20/-429496746/37
-13/-429496759/37
-13/-429496758/37
2/-429496749/36
2/-429496748/36
2/-429496747/36
-15/-429496758/38
-15/-429496757/38
0/-429496748/37
0/-429496747/37
.
.
.
When I show formulas in the Excel file the data looks like this:
35225781579640
35225781730541
35225781947742
35238693176684
35241364002568
35241364163669
35241364316770
These number appear to be too large to be an Excel date. Anyone know what this is? Is the conversion to a dataset screwing up the data?
Thanks
Everything makes sense in someone's mind
|
|
|
|
|
Kevin Marois wrote: These number appear to be too large to be an Excel date. Anyone know what this is? Is the conversion to a dataset screwing up the data?
Dates in Excel are stored as real numbers where the integer portion is the date in days since the epoch (1 January 1900) and the fractional portion is the time as a fraction of 24 hours, thus .5 is 12:00 noon. So when you read these values from the spreadsheet you will need to convert them to proper DateTime values before storing them in your dataset.
|
|
|
|
|
hi every one
how to create menu with directx in c#
thanks
|
|
|
|
|
with code.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hello,
How we can test if a directory is empty? thank you verry mutch.
|
|
|
|
|
If Directory.GetFiles[^] is not returning any data, consider it is empty.
Best wishes,
Navaneeth
|
|
|
|
|
const string MYDIR = @"C:\MYDIR";
string[] files = Directory.GetFiles(MYDIR);
string[] dirs = Directory.GetDirectories(MYDIR);
if(files.Length == 0 && dirs.Length == 0)
{
}
|
|
|
|
|
Hi,
before .NET 4.0:
the easiest way is testing Directory.GetFileSystemEntries().Length==0 as this method returns the names of all files and folders.
and yes it is a pity you have to ask for a potentially huge array of data just to get a true/false result.
the alternative is to use P/Invoke and use FindFirstFile (not sure if and how that works for subdirectories).
since .NET 4.0 there are new siblings to GetFileSystemEntries and the like (see EnumerateFileSystemEntries) that return results only one at a time and don't burden the CPU and memory that much, as you can opt out right away.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? 59.24% waren verstandig genoeg om NEEN te stemmen; bye bye viaduct.
|
|
|
|
|
I want totransfer files from a client to another, using socket programming+c#?
|
|
|
|
|
So on what part are you facing problem?
Best wishes,
Navaneeth
|
|
|
|
|
never heard about google ?
you can find also in codeproject, there are lots of sample for that.
|
|
|
|
|
Hi
I am writing a small class that covers a multitude of areas for CD use.
I am using IMAPI2, and managed to get the buring, formatting and erasing process going, but I haven't been able to find anything for reading from a disc.
Does IMAPI2 do this, or is there another way of doing this?
Please help!
Thanks
|
|
|
|
|
|
Hi
I know about this article, but it does not provide for reading data from a CD into an application, which is what I want to do.
The solution, I am looking for is a way to read data off a disc into a database. Therefore, I need to stream data off a disc into a object.
Thanks
|
|
|
|
|
|
Hello,
I frequently write many SQLs and would like to embed in C# code (SSMS 2005/VS.NET 2005). There was macro which would let me select the code and hit a shortcut to format it into C# code. Has anyone seen where it is now?
Thanks,
Raghu.
You can never try. You either do it or you don't.
|
|
|
|
|
Do I understand that you want a macro to copy SQL statements into a C# file?
I thought it was Ctrl+C, Ctrl+V
only two letters away from being an asset
|
|
|
|
|
Hmm... haven't heard that before, but I'll give it a try...
I was referencing converting a SQL statement to C# string...
But, here's what I came up with in case someone needs this... Assign this macro a short cut of of Ctl+Shift+F3
It converts
select *
From Status
From ActivityStatus ActStsId=StsId
to
string sql = " select * "+
" From Status "+
" From ActivityStatus ActStsId=StsId";
Macro is as follows.
Sub SQL2CSharp()
Dim selection As EnvDTE.TextSelection
Dim startPoint As EnvDTE.EditPoint
Dim endPoint As TextPoint
Dim quoteStart As String
selection = DTE.ActiveDocument.Selection()
startPoint = selection.TopPoint.CreateEditPoint()
endPoint = selection.BottomPoint
quoteStart = """"
DTE.UndoContext.Open("SQL 2 CSharp")
Try
startPoint.Insert("string sql = """)
Do While (True)
Dim line As Integer
line = startPoint.Line
startPoint.Insert(quoteStart)
startPoint.EndOfLine()
If (line = endPoint.Line) Then
startPoint.Insert(quoteStart & ";")
Else
startPoint.Insert(quoteStart & "+")
End If
startPoint.LineDown()
startPoint.StartOfLine()
If (line = endPoint.Line) Then
Exit Do
End If
Loop
Finally
' If an error occurred, then make sure that the undo context is cleaned up.
' Otherwise, the editor can be left in a perpetual undo context.
DTE.UndoContext.Close()
End Try
End Sub
You can never try. You either do it or you don't.
|
|
|
|
|
Why would anyone need or want this? You SHOULD NOT be using inline SQL at all.
only two letters away from being an asset
|
|
|
|
|
Are you suggesting I should use the alternatives for SQL like SPs, functions, views etc?
You can never try. You either do it or you don't.
|
|
|
|
|
Only if you want your applications to perform better, be more maintainable and more secure
only two letters away from being an asset
|
|
|
|
|
And why the hell would we want that?!
|
|
|
|
|
Why would this be insecure if there is no WHERE clause associated with the SQL statement?
Depending on if it is a reusable/non-reusable SQL statement, I think its a personal preference to keep the SQL in code or move it to database.
You can never try. You either do it or you don't.
|
|
|
|
|
If you have to ask it shows you really have no idea what your doing. Help make this profession better, drop out now.
only two letters away from being an asset
|
|
|
|
|
I never would've thought this kind of comment would come from a CodeProject supporter. I'm just thinking about this kind of response in general is what makes a good or bad forum.
Now, if you can please answer the question (which was a genuine one), everyone who reads this thread now and a few years from now will learn something.
You can never try. You either do it or you don't.
|
|
|
|