|
Using the code below. Set up a button that would take the value of textbox 2 so that I can pass it to another part of this application? How would you suggest setting up two other queries that would join with the first query to fill in other textboxes?
EX:
Textbox 1 = query1 (main query) textbox 2 = query1 (main query) textbox 3 =query2 (sub query) textbox 4 = query3 (sub query 2)
Sub query -> select column a from table2, table1 where id.table1 = id.table2
And then
Sub query 2 -> select column c from table 2, table 1 where id.table1 = id.table2 and column a – column b
Thank you in advance
public Form1()<br />
<br />
{<br />
<br />
InitializeComponent();<br />
<br />
}<br />
<br />
string tb1 = "*";<br />
<br />
string tb2 = "*";<br />
<br />
private void textBox1_TextChanged(object sender, EventArgs e)<br />
<br />
{<br />
<br />
if (textBox1.Text.Length > 0)<br />
<br />
{<br />
<br />
tb1 = textBox1.Text;<br />
<br />
}<br />
<br />
else <br />
<br />
{ <br />
<br />
tb1 = "*";<br />
<br />
}<br />
<br />
performQuery();<br />
<br />
}<br />
<br />
private void textBox2_TextChanged(object sender, EventArgs e)<br />
<br />
{<br />
<br />
if (textBox2.Text.Length > 0)<br />
<br />
{<br />
<br />
tb2 = textBox2.Text;<br />
<br />
}<br />
<br />
else<br />
<br />
{<br />
<br />
tb2 = "*";<br />
<br />
}<br />
<br />
performQuery();<br />
<br />
}<br />
<br />
public void performQuery()<br />
<br />
{<br />
<br />
string yourQuery = "SELECT * FROM Table1 WHERE Column1 = " + tb1 + " AND Column2 = " + tb2;<br />
<br />
<br />
}
|
|
|
|
|
cmandy,
This sounds a bit homework related...
Regards,
Gareth.
|
|
|
|
|
Gareth,
I graduted 3 years ago. I am new to the c# .net world.
|
|
|
|
|
At the core, if this is not homework, then the answer is, 'don't do this'. Your code is wide open for SQL injection attacks. Give your variables real names, use stored procs, and use delegates to get different classes in your app communicating with each other.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
How can make a programs that understand visual object like Simulator programs.
|
|
|
|
|
That is a pretty big topic. Good luck
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
That's a pretty open ended question. Did you have a specific type of simulator in mind?
/ravi
|
|
|
|
|
Hi all,
In my application when some works are finished the program should automatically send an email to some persons (their emails are known before). The point is, different user can do this operation on different PCs, so I want to get the standard email account on the PC where my application is started from.
Using the class "MailMessage" like:
MailMessage message = new MailMessage(
"myhardcodedemail@myprovider.com",
"email.address@mycollegue.com",
"The Subject.",
"Some useless text to build the body….");
works perfect, but I don’t want to write the “from” email hard coded, I want to get it programmatically (All users are using MS Office Outlook 2007 – if this is important).
Another Question is: is it possible to send at once the email to many people (how should the “to” field looks like ?), or I must send it to each one (repeating the step for each user – this works).
For any idea thanks in advance.
Best Regards,
Emil
|
|
|
|
|
Emanuil ACHIM wrote: I want to get it programmatically
You might want to consider querying a remote service (or data store) to get the information (such as the user's email address) specific to the user.
Emanuil ACHIM wrote: is it possible to send at once the email to many people
Yes. See the CC property.
/ravi
|
|
|
|
|
If you're using Outlook/Exchange, when a user logins in on Windows, the users e-mail address is associated with their Windows login(depending on how you're setup but this is the typical scenario)
|
|
|
|
|
I have something really strange happening that I want to run by you folks. Frequently when I add a new button to Form1.cs[Design] the button appears in the IDE, the button is listed in the Form1.Designer.cs, The button is not hidden or behind another form, but the button does not show in the compiled program. This happens when compiling under Vis 2005. I had thought that maybe there was a defect in my compiler so I reinstalled Vis 2005 and I get the same results. Whats really strange is when I take the same code and recompile under Vis 2008 the button appears in the compiled program and works as it should.
I have now discovered that after compiling the code with Vis 2008 I can go back to Vis 2005 and recompile the code that didn't compile properly and it will compile. Vis 2005 will run properly for a while until it repeats the problem above which I find I can fix each time by running Vis 2008.
modified on Sunday, February 17, 2008 10:30 AM
|
|
|
|
|
Hi George,
very strange indeed. I've never seen that with my Visual 2005.
There are some bugs in VS2005 C# Express Edition, where Visual gets confused
and I have to delete the bin and obj directories, then rebuild.
You could try that. If it does not help, I Can't help you unless you send
the entire project I'm afraid, so I could have a look. No guarantees though.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
I ran Vis 2008 and now all is well. I don't know when the problem will occur again but when it does I will try your suggestion.
TNX.
|
|
|
|
|
Is that an inherited button? Did you check what's the different between VS2005 and VS2008 for the portion related to the button in the InitilizeComponent()?
|
|
|
|
|
hi,
does any one know a good class which can post data to a http server and most important read back posted data?
Thanks, i really need it urgent!
|
|
|
|
|
I know few classes, check out System.Net.WebClient ,System.Web.HttpRequest and System.Web.HttpResponse ...
|
|
|
|
|
Eli Nurman wrote: class which can post data to a http server and most important read back posted data?
Sure! That's exactly why I designed this[^] class.
/ravi
|
|
|
|
|
Thanks, but i need a class that could read POSTED data. like if I'm sending to a page which response me with post info (credit card clearing for example) i need to read the post only. do you know any solution?
|
|
|
|
|
Eli Nurman wrote: sending to a page which response me with post info
Do you mean the web page to which you posted data (eg: the credit card number) returns a response (eg: validation success/failure) to the client via a POST ?
/ravi
|
|
|
|
|
yes, that is exactly it! how is it possible to read the POST sent?
BTW i think all clearing companies do so (sending the transactioID etc... data)
|
|
|
|
|
Hi Eli,
Eli Nurman wrote: how is it possible to read the POST sent?
The only thing I can think of is that you'd have to have a server to receive responses from the clearing house.
Eli Nurman wrote: i think all clearing companies do so
I would've thought they send back some token as part of the response, allowing you to conduct an encrypted conversation in order to process the transaction. Much like a series of web service calls.
The "POST response" story seems odd to me, but that's just my opinion.
/ravi
|
|
|
|
|
Thanks Ravi
I guess so
but if there is a class that allows me to read the entire data that has send including headers and post data that can be useful to, no? and then analyze the post data into a dictionary
So if you know a tool that responses the entire received data from the "HTTP/1.1 200 OK" until the end of document please let me know.
Thanks
|
|
|
|
|
I think you want to use the Headers property of HttpWebResponse to get at the headers.
/ravi
|
|
|
|
|
Is it possible (probably by Windows Messages or API) to generate a Moving event for a form and get it's current rectangle so I can cancel the movement if outside the area I specify?
I've tried using the Move and LocationChanged events but they are only raised AFTER the move has taken place, not during.
I've had a browse around Google but with no success so far...
Dave
|
|
|
|
|
Hi,
there is a Form.LocationChanged event; its EventArgs does not offer a Cancel
property, so you would have to remember the old location and restore it, to undo
a move.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|