+1 To BULK copy and format files.
Ryno Burger
Posts
-
fastest method -
CancerSorry to hear that. All of the best for you and your family.
-
Request is not available in this contextHi guys I have a function called SendEmail which runs within a thread. This function simply send an email to the user. However, I made a "Please Wait..." page while the email gets send in the background the user see the "Please Wait..." page.
public void SendEmail() { StringBuilder messageText = new StringBuilder(); messageText.AppendLine(string.Format("Name: {0} {1}", txtName.Text.Trim().ToString(), txtSurname.Text.Trim().ToString())); messageText.AppendLine(string.Format("Contact Number: {0}", txtContactNumber.Text.Trim().ToString())); messageText.AppendLine(string.Format("Email Address: {0}", txtEmail.Text.Trim().ToString())); messageText.AppendLine(string.Format("Comments: {0}\n\n", txtComments.Text.Trim().ToString())); messageText.AppendLine(string.Format("Quote Reference Nr: {0}", Request.QueryString["quoteNr"].ToString())); // Breaks here with error: Request is not available in this context // Send the email to the user }
I call the SendEmail() function using the following lines of code:Guid id = Guid.NewGuid(); ThreadStart ts = new ThreadStart(SendEmail); Thread th = new Thread(ts); th.Start(); Response.Redirect(string.Format("PleaseWait.aspx?ID={0}&type={1}", id, "email"));
Is it true that you can't access Request data within a thread, if not, how do I then get access to Request.QueryString data? -
Request is not available in this contextWhat do you mean? I left some code out for simplicity and readability reasons... May I ask, why do you reply if you don't want to offer help in the first place? Isn't that like... well... wasting your own valuable time? :wtf:
-
Request is not available in this contextHi guys I have a function called SendEmail which runs within a thread. This function simply send an email to the user. However, I made a "Please Wait..." page while the email gets send in the background the user see the "Please Wait..." page.
public void SendEmail() { StringBuilder messageText = new StringBuilder(); messageText.AppendLine(string.Format("Name: {0} {1}", txtName.Text.Trim().ToString(), txtSurname.Text.Trim().ToString())); messageText.AppendLine(string.Format("Contact Number: {0}", txtContactNumber.Text.Trim().ToString())); messageText.AppendLine(string.Format("Email Address: {0}", txtEmail.Text.Trim().ToString())); messageText.AppendLine(string.Format("Comments: {0}\n\n", txtComments.Text.Trim().ToString())); messageText.AppendLine(string.Format("Quote Reference Nr: {0}", Request.QueryString["quoteNr"].ToString())); // Breaks here with error: Request is not available in this context // Send the email to the user }
I call the SendEmail() function using the following lines of code:Guid id = Guid.NewGuid(); ThreadStart ts = new ThreadStart(SendEmail); Thread th = new Thread(ts); th.Start(); Response.Redirect(string.Format("PleaseWait.aspx?ID={0}&type={1}", id, "email"));
Is it true that you can't access Request data within a thread, if not, how do I then get access to Request.QueryString data? -
floating values issueGreat stuff!! Thanks to both of you that replied. It works perfectly!!! :-D
-
floating values issueHi, I havn't dealt much with floating numbers / calculation since recently. Let me explain my issue: I have the following 3 values declared:
float overallTotalAmps = 0; int voltage = 230; int overTotalWatt = 126;
on which I do the following calcluation:overallTotalAmps = float.Parse((overallTotalWatt / voltage).ToString());
The value of overallTotalAmps always returns 0.00 which should be 0.55 (126 / 230). Am I using the incorect data type here or perhaps if someone could just point out to me what it is I'm doing wrong here? :wtf: Thanks. R -
Error - 182 -The left-hand side of an assignment must be a variable, property or indexerHi Luc Thank you very much for your reply. Your solution made my error very clear and I get what I did wrong now. Thanks once again.
-
Error - 182 -The left-hand side of an assignment must be a variable, property or indexerHi, I'm trying to unbox a value stored in ViewState using the code below: I can't seem to figure out what I'm doing wrong, can someone please perhaps point out what I'm doing wrong or perhaps an alternative? :wtf:
(Int32)ViewState["totalLightsWatt"] = ((Int32)ViewState["totalLightsWatt"]) + (Int32.Parse(txtLightsQty.Text.Trim().ToString()) * Int32.Parse(cboLightsItems.SelectedValue.ToString()));
Thanks. R -
Deleting words from stringI was thinking of Regex but wasn't sure. Thanks for that Kain!
-
Being more genericHi guys I wanna know how I could make the following function more generic and stop writing tedious code... My current example function:
public SqlCommand SetupCommand() { SqlCommand cmd = new SqlCommand(); cmd.CommandText = "SELECT * FROM Test"; cmd.CommandTimeout = 180; return cmd; }
The above snippet of code will return a SqlCommand object. However there is cases where I would like this very same method but this time around returning a OleDbCommand object. Is there a way to make this method more generic to be able to return any Command types e.g SqlCommand, OleDbCommand without having to re-write code all the time. I guess I'm searching for something similar to IDataReader that can return either SqlDataReader or OleDbDataReader. Thanks in advance. R. -
MS Access 2003 and TriggersHey guys Not sure if this is the appropriate forum but let me give it a go anyways. I’m trying to simulate triggers in MS Access 2003 from a .NET platform using C#. Is there anybody out there that perhaps faced the same challenge and if so can you please give me some guideline where to start. Any background, information of guidelines will be highly appreciated. Thanks. R
-
Deleting words from stringIs there a neater more professional way to re-write the code below?
public string StripString(string statementString) { string alteredStatement = string.Empty; string keyword1 = "[dbo]."; string keyword2 = "["; string keyword3 = "]"; string remover = ""; string tmpStr1 = statementString.Replace(keyword1, remover); string tmpStr2 = tmpStr1.Replace(keyword2, remover); alteredStatement = tmpStr2.Replace(keyword3, remover); return alteredStatement; }
-
Deleting words from stringNevermind I got it now, I'm just being stupid today... Thanks again guys!
-
Deleting words from stringBut what if you were to remove a word like '{test}' including the braces?
-
Deleting words from stringThanks to both of you that replied!! R
-
Deleting words from stringHi guys How can I delete all occurrences of the word 'test' from a string I.e. String Before: This is a test to delete all occurrences of the word test String After: This is a to delete all occurrences of the word Please give me some guidelines here. Thanks R
-
Upload and download measurementHi guys Is there any way to measure the download and upload capabilities beforehand when sending and receiving files via TCP transmission based on the file size of the file being sent or received? Thanks BS
-
Passing a List object to an xslt fileHi guys, If possible do any of you know how I can pass a List object to my xslt which will form part of my SQL query? This is what I'm tryin to achevive: First of all I will have a class being serialized and then deserialized using XML serialized in the case Client.cs. In the class I have a List property which will return a list of Client names: public List ClientNames Now in the next step I have an xslt that will transform my deserialized class and which will use the class properties as parameters to my SQL query. The code within the xsl are as follows: SELECT * FROM Client WHERE Client.ClientFirstName IN ('Test', 'Ben', 'Tom') Now what I'm trying to achieve is to pass the List object to my SQL IN clause using xslt... is that possible? Any help will be greatly appreciated. R
-
Run a win32 app remotely?Hi guys, The following question I have is not directly a problem I’m having but rather a solution that I’m looking for. I have a win32 application written in .NET 2.0, basically a forms over data applications sending data back and forth to a SQL Server 2005 database. Now, our clients do not want to remote desktop to the server where the application and SQL server resides on, but rather be able to have user have like a client sitting on their local machines accessing the .exe application remotely. I don’t know if that is possible in the first place, so basically I’m looking for a solution where my users will be able to run the win32 application remotely without having to be on the physical server i.e. remote desktop to it. Has anybody out here faced a similar challenge before? I hope I make sense and hope to get your feedback soon. Thanks. R