|
If you are using SqlServer 2008 there are Date , Time , DateTime , SmallDateTime , DateTime2 and DateTimeOffset datatypes. Pick the one which fits your use.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
You should spend some time thinking about what it is you're doing. What happens if you want to display the date in a different format later ? What if you want to search for all objects within a date range ? These are the reasons you store a date as a date and let the presentation layer worry about how a date should be presented.
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.
|
|
|
|
|
Try the following transact-sql..
SELECT CONVERT(CHAR(10), GETDATE(), 103)
convert a DateTime ('2004-06-24 06:01:40.000') to a simple date format ('dd/mm/yyyy' )
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
I'm a newbie to VB.NET and I' m trying to write a small Windows forms app that searches a network drive for a folder and reads the specified file. It seems like the best approach would be to use the System.IO classes to search the directory and open the files. My question is do I need to open a socket and use the Network Stream object to access this network file? If the computer is just a terminal already connected to the network is this required or do I simply need file permissions on that machine to access the file?
Any advice would be greatly appreciated!!
|
|
|
|
|
rbc1025 wrote: do I simply need file permissions on that machine to access the file?
Correct.
If it's just a regular network share, you can access it just like a local file.
|
|
|
|
|
Thanks Ian. I didn't have all the details of the network when I was posting. I feel a bit ignorant as I realized it would obviously appaer as virtual drive to the networked machine. Thanks for your response!
|
|
|
|
|
I agree with you.. But i think it will cover on local environment not remote...
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
If you can already see the directory the files are in using standard Directory and File methods, why would you need to open a socket to the server to read the file?? You just open the file like you would any other local file on your machine.
|
|
|
|
|
Thanks Dave! I realized shortly after I posted this that it would appear as a simple drive on the networked machine. I didn;t have all the details before I posted but I thank you all the same.
|
|
|
|
|
Hi,
Can anyone guide me on a simple code to load a directory into a listBox and When I click a file it loads in its respective format.
I look all over the place, what I found is confusing and not compatable with visual studio 2005
thanks,
|
|
|
|
|
Look at the Directory.GetFiles() method. It'll return an array of filenames in the directory you specify. You can then add those names to the ListBox.
When the user clicks the file, you can use the Process class to launch the file. You don't need to know what application opens the file.
|
|
|
|
|
Thanks,
I did something like this below but i cannot get it to list the file in a listbox:
Dim Files As String()
Dim FileName As String
Files = directory.Getfiles("C:\", "*")
for each fileName in Files
listbox.text=FileName
next
the file will not list in the listBox
thanks again
|
|
|
|
|
Hi,
every Control has a Text property; for simple Controls, such as a Label, that sets the content.
For listing Controls (ListBox, ListView, ...) the content is a collection, often called Items.
If all this is new to you, I strongly suggest you pick up a book on Windows programming, then use MSDN or google to refresh your memory on specific details.
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
You are right but listbox.items is READONLY property..
so how can i achieve my goal here?
|
|
|
|
|
|
|
waner michaud wrote: listbox.items is READONLY
I know, and I'm glad it is. I don't want to replace the collection by another one; I often want to operate on the collection though.
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
hi expert
i want pass value in textbox when I addition of two number in javascript.
ex.
var c = parseFloat(a) - parseFloat(b);
textbox1.text=c;
This example is not work.
|
|
|
|
|
You have 'javascript' and 'asp.net' in your subject yet you decided the 'visual basic' forum was the place to post your question.
|
|
|
|
|
It's a crosspost, I just saw the answer elsewhere...
|
|
|
|
|
At the moment of my posting here it wasn't I checked.
I guess he read my reply and then went to ask in the correct forum.
|
|
|
|
|
Hi,
I need help with this following code. It's to read word stored in two text files and storing in a arry for someprocessing later. this code works fine when the text files are below 10kb .it gives error in line marked bold when it's around 19kb..can some one help me to sort it please..? the error is "Key cannot be null. Parameter name: key" on that red marked line
Imports System.IO
Imports System.Text
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Button1.Enabled = False
Dim ga As Integer = 0, ba As Integer = 0
Dim gaen As Integer = 0, baen As Integer = 0
' totalbad As Integer = 0
' reading good words dictionary file
Dim goodReader As StreamReader = File.OpenText("good.txt")
' reading bad words dictionary file
Dim badReader As StreamReader = File.OpenText("bad.txt")
' creating array with the good words
Dim gl As New ArrayList()
Dim hshgood As New Hashtable()
While Not goodReader.EndOfStream
gl.Add(goodReader.ReadLine())
If goodReader.ReadLine() IsNot Nothing Then
hshgood.Add(goodReader.ReadLine(), goodReader.ReadLine())
End If
End While
' creating array with the bad words
Dim bl As New ArrayList()
Dim hshbad As New Hashtable()
While Not badReader.EndOfStream
bl.Add(badReader.ReadLine())
If badReader.ReadLine() IsNot Nothing Then
hshbad.Add(badReader.ReadLine(), badReader.ReadLine())
End If
End While
Thanks
Surej
|
|
|
|
|
Surej70 wrote: While Not goodReader.EndOfStream
gl.Add(goodReader.ReadLine())
If goodReader.ReadLine() IsNot Nothing Then
hshgood.Add(goodReader.ReadLine(), goodReader.ReadLine())
End If
End While
How many lines would this read in one iteration of the loop?
Are you sure the number of lines in the file is a multiple of that number??
BTW: in a HashTable all keys must be non-null and different; can you guarantee they will all be different?
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Hi,
Thanks for the reply. actually i am trying to help a friend of mine and i am not really good with this. If you have time can you please have alook at it..? I have uploaded in rapidshare.
http://rapidshare.com/files/287639191/compare.rar
there are two text files "bad.txt" and "good.text" these files will work with out any problem the other ones that dont work are good2 and bad2. these got more words in.
Thanks
Surej
|
|
|
|
|
Hello Every body ,
Can anyone provide solution to this error .As this error is related to Change of PC name.But i dont know solution to get through it.So plz need Help ....
-2147467259 :[Microsoft]ODBC SQL Server Driver (The Cursor does not include the table being modified. Or the table is update able through the Cursor.)
Thanks in advance.
|
|
|
|