|
I'm affraid that you are right about that. I ended up with using a web service hosted on the com hosted server, and then call the get HTTP request needed in URL form to send message. Using webBrowser object in my desktop application (without opening it visually ofc), and it seems to work this way. Then there is just a request about keep the webhosting service running on the server.
|
|
|
|
|
The other question is does it work with multiple clients at the same time??
|
|
|
|
|
I doubt that the webpage request from the server is thread safe. Since its an sms service, it will overflow the GSM modem with AT commands, if there isn't a short sleep timer. But in my case it doesn't matter, since there is no concurrency problem in this case, which means there is only one person at time sending commands by using this service.
|
|
|
|
|
No, it's not. That's the point of the question. If you had more than one person hitting the service at the same time, one instance would get access to the serial port and the other would throw an exception that the port is busy. The question is how does your service code handle that little problem.
|
|
|
|
|
Hi guys
I'm quite new to c#
I'm writing a little jobby to spit the contents of a SqlDataReader out into an HTML table as a string.
How can I find the datatype of each field in the data reader so that I can format it correctly? (dates, money etc)
Thanks
If your wife wants to learn to drive, don't stand in her way...
|
|
|
|
|
SqlDataReader.GetDataTypeName : Gets a string representing the data type of the specified column
|
|
|
|
|
Try...
dataReader1.GetFieldType(0)
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
Unsy wrote: a little jobby
You're not in Scotland, are you?
This has quite a different meaning there. Although it's usually referred to as 'a wee jobby'.
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
The only valid measurement of code quality: WTFs/minute.
|
|
|
|
|
Hi Im pretty new at C# (and also new here!). I am working on a form with a listbox with Multisimple selection mode. Problem is when i select the files, I want the file selection to be in the order of selection
eg
lets say i have item '1', '2', '3' in the listbox
'1'
'2'
'3'
i want to select '3',then '1' and lastly '2' but the items in listBox1.SelectedItems are always stored in '1''2''3'.
Thanks in advance
|
|
|
|
|
The ListBox will not keep track of your selection order; all it keeps track of is the selected state for each of the items; as a result SelectedItems will enumerate the selected items in their order of appearance.
You need to implement your stuff yourself; just keep your own chronological list of selected items, wire up the SelectionChanged event, and adapt your list accordingly every time the selection changes; remember an item can be removed from the selection too!
|
|
|
|
|
Luc Pattyn wrote: The ListBox will not keep track of your selection order; all it keeps track of is the selected state for each of the items; as a result SelectedItems will enumerate the selected items in their order of appearance.
You need to implement your stuff yourself; just keep your own chronological list of selected items, wire up the SelectionChanged event, and adapt your list accordingly every time the selection changes; remember an item can be removed from the selection too!
thanks for the reply. I tried to keep a list of selected items, but listbox1.selecteditem wont return the current selected item (ie lets say i selected '3' and then '1' and then '2', then listbox.selecteditem will always return '1' cause its the first in order)
|
|
|
|
|
yes, you need to compare all entries in SelectedItems with your private list and adapt the latter.
BTW: it will not be a nice GUI that takes order into account but does not show the order at all! One way to solve that is by moving the items around (moving the item selected last above the topmost unselected one), but I would hate to use that too, as I don't like a GUI with moving objects.
|
|
|
|
|
thanks, will give it a shot
|
|
|
|
|
I'm creating a new program. The ONLY thing which is important for me is the running time of the program. Should I use a regular expressions, or maybe should I write my own search code?
|
|
|
|
|
Without knowing what you are trying to achieve, it's hard to give any answers. I will say that a well designed regular expression will generally be faster than a roll your own search and replace algorithm, but a badly designed one can really kill performance when applied to large a data set. If, however, your search/replace doesn't naturally fit into a regular expression don't worry about it. Far too many times, people will contort themselves to write hugely complex regular expressions when a simple string.Replace would have sufficed.
"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
|
|
|
|
|
A regex may win when it involves a complex operation that fits well with a regex approach; OTOH most of the time regexes are both more cryptic and slower than a few explicit string operations. I once performed this experiment[^].
|
|
|
|
|
I'd say write your program whichever way suits you. Then if performance is a problem profile it to find out where it is spending time. Then, and only then, think about how to speed it up.
As has been pointed out, regexes may be faster, then again they may be slower.
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
The only valid measurement of code quality: WTFs/minute.
|
|
|
|
|
Hello All,
I am very much new to C# ...
I am trying to log in to website and download some information.
is it possible to do that using C# ??
Please suggest me some ideas
Thanking you,
Naveen HS.
|
|
|
|
|
Can you please elaborate more on your
question so that it is easier to answer it?
What you are trying to download and from
which site using csharp ?
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
Hi Jinal Desai,
Thanks for the response.
consider some some website www.somesite.com , that has login id & password, once we login it takes to information page, i am trying to download the content from the information page.
so can you please give some suggestions how to start with this work ??
|
|
|
|
|
Hi Naveen,
you can study WebClient class.
http://msdn.microsoft.com/en-us/library/system.net.webclient(VS.80).aspx
|
|
|
|
|
you want the HttpWebRequest and HttpWebResponse classes, and the Credentials property. Use Google to get lots of examples.
|
|
|
|
|
I have the same problem to login to a website, therefore i have only a half answer.
I know 4 methods to download informations from a website.
1. System.NET.WebClient
This is a native Client class to download Data or the html string from a internet adress.
WebClient webClient = new WebClient();
webClientData = webClient.DownloadData(uri);
as far as i know it is possible to login to a website with this class, but i never have find out how.
2. System.Windows.Forms.WebBrowser
This is a internet explorer class for the framework. You can login to a website, because it uses the variables/cookies/etc. from the internet explorer.
3. System.NET.WebRequest
In this class it's possible to use POST and GET, this is needed to login to a website, but i don't know how to POST login informations, i only know how to donwload the data from a website.
byte[] buffer;
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
System.IO.Stream s = resp.GetResponseStream();
4. TCP Socket
Yes, this protocol bases upon to TCP, you can connect to the website and communicate over the Hypertext Transfer Protocol with the website.
If you need more informations about the methods, you can use google.
I hope i could help you a bit and sorry for my bad english.
|
|
|
|
|
Hi.
please tell me my mistake in blow code,code not return any value.. please help
string query2 = "select sum(amount) Total from pur_inv_dtl where inv_id = '" + IdTxt.Text + "'";
SqlCommand cmd2 = new SqlCommand(query2, conn);
try
{
conn.Open();
SqlDataReader sdr = cmd2.ExecuteReader();
while (sdr.Read())
{
Gtotal.Text = sdr["Total"].ToString();
}
}
finally
{
conn.Close();
}
|
|
|
|
|
Not sure of all the types of the fields but try this
string query2 = "select sum(amount) AS Total from pur_inv_dtl where inv_id = '" + IdTxt.Text + "'";
|
|
|
|