|
|
How can I retrieve data to a Label box using SQL Server
|
|
|
|
|
|
Very minor point: Note that the connection string might not be identical in terms of the # of \'s. At least using VB6 and C++ .NET the connection string might contain two \\ characters while VB6 using a single \.
|
|
|
|
|
Has anybody seen a full implementation for a date(time) class/struct in C#?
I don't need this for a project or anything (the built in one seems adequate for dealing with date and time constructs for business apps). However, I have a friend who is trying to pick up some of the more arcane OO concepts in C# and I thought such an example might give good coverage of operator overloading, serialization, etc. I had to do one way back in the day with C++, so I thought something similar might be a handy way of explaining the same concepts to him.
|
|
|
|
|
There is a very good example in Charles Petzold's publication .NET Book Zero[^].
|
|
|
|
|
I used reflector to browse through the DateTime code a while back. You could always use that.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Hi all,
I dont know in which forum i have to post this issue. If i am wrong please guide me to post in which form
I am developing a vb.net desktop application that reads mails from the mailserver using pop and imap .
The application is almost fnished .The problem is the some time when a command is send to retrieve a mail using GetMessage() functions the applications is going to a halt
So I tried to run the the code in debug mode and ran line by line .
What I noticed is in the while loop in GetMessage() function is
While Not tmpString.StartsWith(sPrefix)
tmpString = reader.ReadLine
msg = msg & tmpString & vbCrLf
End While
The reader reads line by line at certain point of time it got hangs
Some times it ill catch an exception and give an error . I am pasting the exception below
"Received an unexpected EOF or 0 bytes from the transport stream"
But some times the applications will hang and go for a halt .This applications has to run 24/7 .So if it hangs in the night or it will be problem .
What I want is if the reader is not able to read from the stream after certain time period . the control has to be removed from the reader and the function has to return a message . I am new to this the network level applications and I am running shot of time
So I am in big trouble . If anybody knows this problem please help me
I have pasted the code briefly so that you can get an idea about the program
Dim objTCP As New TcpClient
Dim sslstream As Net.Security.SslStream
Dim reader As StreamReader = Nothing
objTCP.Connect(IMAPserver, Port)
sslstream = New Net.Security.SslStream(objTCP.GetStream())
sslstream.AuthenticateAsClient(IMAPserver) ' authenticate as client GMAIL
AuthStatus = sslstream.IsAuthenticated
reader = New IO.StreamReader(sslstream)
Function GetMessage(ByVal sCommand As String, ByVal sslstream As SslStream, ByVal reader As StreamReader) As String
Dim tmpString As String = ""
Dim msg As String = ""
Try
sendcmd(sCommand, sslstream)
tmpString = reader.ReadLine()
If tmpString <> "" Then
msg = msg & tmpString & vbCrLf
End If
While Not tmpString.StartsWith(sPrefix)
tmpString = reader.ReadLine
msg = msg & tmpString & vbCrLf
End While
If InStr(msg, "BAD Could not parse command") > 0 Then
'MsgBox("BAD GETMESSAGE")
End If
Catch ex As Exception
appendFile(strErrPath, "Error in GetMessage, BAD command : command : " & sCommand & Space(3) * "User: " & UserName & ex.Message & Date.Now)
End Try
Return msg
End Function
|
|
|
|
|
You should paste the exception you are getting (message and type).
At first glance it seems like the while loop has a bad condition, the reader reaches the end of the stream and you are trying to read a line.
Add a condition to your while using reader.EndOfStream.
if(not reader.EndOfStream)
{
tmpString = reader.ReadLine()
If tmpString <> "" Then
msg = msg & tmpString & vbCrLf
End If
While not reader.EndOfStream && Not tmpString.StartsWith(sPrefix)
}
|
|
|
|
|
Hi
I have to create a windows application which can connect to a remote host through SSH and can perform some operations on the remote host.
remote host is a cisco router 3745
Problem I am facing is which ssh client to use and how to use in the application.
If anybody knw please update me @ himanshu_agarwal@live.com / himanshu.agarwal@gmail.com
|
|
|
|
|
|
Hi.,
How to print a crystal report in a dotmatrix printer using vb.net code and printing should be fast?
Any ideas...
Thanks & Regards
Raj
|
|
|
|
|
hi Raj
You can use 12dpi fonts, all your crytal report contents to be printed should be in 12 dpi font.
These fonts are added to windows fonts once you install Dot matrix printer drivers.
if these fonts are used printing will be faster compared to windows fonts
cheers
saleem
cc
|
|
|
|
|
I would like to know if is there any parameter which let me ask for confirmation of the Mail arrival using System.Net.Mail and the sender SMTPClient.
modified on Thursday, November 19, 2009 7:47 AM
|
|
|
|
|
This is a programming question and doesn't belong in the Lounge. Try this forum instead. Either that, or Quick Answers.
Visual Studio is an excellent GUIIDE.
|
|
|
|
|
You need to refactorize the incoming param list, and possible invoke the method if concurrency is required, also create a method extension this will help during execution of the object.
Hope this helps. Further help can be found in the correct programing forum - which I'm sure you will find - assuming you have the aptitude to program computers.
|
|
|
|
|
Norm .net wrote: You need to refactorize the incoming param list, and possible invoke the method if concurrency is required, also create a method extension this will help during execution of the object.
Excellent!
If the above statement does not qualify you for a position at Microsoft Marketing, then I don't know what will.
http://www.codeproject.com/Lounge.aspx?msg=3276898#xx3276898xx[^]
|
|
|
|
|
While the above suggestions are all perfectly valid, you may want to consider calling Reflector programmatically with parameters for each version of the .Net Framework. This will give you the option of seeing what your options are for a variety of deployment scenarios.
Once you do that, you can then use Reflector to dynamically decompile System.Net.Mail into usable code which you can then modify to suit your needs.
One such modification you'll want to make sure you do before proceeding any further would be to create a hash structure so that you can easily ascertain whether or not you've already sent an email. Naturally, this hash structure should be built to serialize to the hard disk when memory consumption is too high. This will reduce your overall network overhead and improve your performance.
Trust me, your manager will thank you just for following those 3 simple steps.
Visual Studio is an excellent GUIIDE.
|
|
|
|
|
What your a masochist. You've been here a while and asked some sensible questions in the C# forum and suddenly you do a Don Juan and tilt a programming question at the Lounge, consider yourself SMACKED, now go back to the C# forum and ask this question.
Ahhh I enjoyed that, we don't get enough of these misplaced questions any more.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Yeah, where have all the good bad members gone?
Visual Studio is an excellent GUIIDE.
|
|
|
|
|
Maybe he was a good member turned bad.
|
|
|
|
|
Ahh bugger CP moved it. They are taking our targets away, I think we need to protest this.....
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Ok, here is the problem that drives me nuts.
I have a datagrid with various data.The first column is the date of the record and it's a string.
The following code gives the error
tempor=Month(dgv1(0, counter).Value.ToString)
On my PC the code works flawlessly.But when i give the application to someone else for BETA testing, it produces the error.
Does it make sense to you ?
I also tried all the variation to the code, i could think of, like using cdate and cstr functions, changing the type of the tempor variable to date, string, using the .string or not at the ende of the code, to no avail
|
|
|
|
|
Johnkokk wrote: Does it make sense to you ?
Not exactly; your title says you are converting from the string "18/8/2009", but your code is converting something ToString() . Can you clarify a bit more what is in dgv1(0,counter) ?
|
|
|
|
|
The field of the datagrid contains "18/8/2009".This is a string.
I am trying to get the month part of this date.
On my computer whatever i try WORKS.
On the other PC whatever i have tried, DOES NOT.
Even if i don't put the .string, DOES NOT work on the BETA tester.
To make it simple.How do i get the month part of the above field to use as an index in an array ?
|
|
|
|