|
No instance of _name created anywhere? You need to create an instance of Service first.
|
|
|
|
|
I'm creating a C# app with an SQL Server database.
In one module, the user has the option to filter the results by clicking on one of the two radio buttons (one is already selected by default), and I don't want to have to keep on re-accessing the database each time the user switches between the filters as it might consume time when the app has to load the data.
I'm using DataAdapter , DataTable , and DataGridView
Is there a way for me to somehow store the data from the database in a cache and then access them and show results that match the filter? How?
modified 29-Aug-16 12:10pm.
|
|
|
|
|
Download a dataset / datatable that can satisfy either filter; then filter THAT locally as required.
|
|
|
|
|
I will give this a try. Thank you
|
|
|
|
|
try
{
MailMessage mail = new MailMessage();
mail.From = new MailAddress("sami.goswami@gmail.com");
mail.To.Add(txtto.Text);
mail.Subject = txtsub.Text;
mail.Body = txtmsg.Text;
SmtpClient Smtpserver = new SmtpClient();
Smtpserver.Credentials = new NetworkCredential("sami.goswami@gmail.com", "password", "smtp.gmail.com");
Smtpserver.Host = "smtp.gmail.com";
Smtpserver.Port = 587;
Smtpserver.DeliveryMethod = SmtpDeliveryMethod.Network;
Smtpserver.EnableSsl = true;
Smtpserver.UseDefaultCredentials = false;
Smtpserver.Send(mail);
label1.Text = "Email successfully sent";
}
catch (Exception ex)
{
label1.Text = "Email failed" + ex.Message;
}
web.config
<pre lang="XML"><configuration>
<system.web>
<compilation debug="true" targetFramework="4.5"/>
<httpRuntime targetFramework="4.5"/>
</system.web>
<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="sami.goswami@gmail.com">
<network defaultCredentials="false" host="smtp.gmail.com" port="25" userName="sami.goswami@gmail.com" password="password"/>
</smtp>
</mailSettings>
</system.net>
</configuration>
|
|
|
|
|
Don;t post this in multiple places: it duplicates work and annoys people.
You already have this posted in QA, leave it there.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Hi, i try to change the background color of RadGridView in background color property but it is not work!! please help me.
Note: I don't want change the background color of row or cell, i want change the background color of RadGridView white to other color? plese help me...
modified 29-Aug-16 13:31pm.
|
|
|
|
|
Why environment? MVC? WPF? Silverlight? WinForms?
".45 ACP - because shooting twice is just silly" - JSOP, 2010
- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
|
hi all,
i want to set custom paper size on printer.
i tried this.
<pre lang="c#">
PaperSize paperSize = new PaperSize("Custom", Current_Paper_Width, Current_Paper_Height);
paperSize.RawKind = (int)PaperKind.Custom;
Current_setting.PaperSize = paperSize;
printDocument1.DefaultPageSettings = Current_setting;
its change the size but the printable area not change.
please help me for this.
thanks.
|
|
|
|
|
You need to use the PageSettings[^] to change the printable area.
|
|
|
|
|
printable area parameter is use only to get value
how can i set
|
|
|
|
|
See the Remarks section on the link I gave you.
|
|
|
|
|
I have been looking for a way to detect when the a console application has ended. I want the ability to do some cleanup. Similar to Application.ApplicationExit in forms applications. I've scoured google, code project, msdn, etc. but no solid solution.
I thought about simply launching a cleanup thread at the start of the program and have it Join the main thread. Once that happens perform cleanup. I tried a test application (see code below):
static void Main(string[] args)
{
Thread cleanupThread = new Thread(cleanupThreadStart);
cleanupThread.Start(Thread.CurrentThread);
Thread.Sleep(5000);
Console.WriteLine("Main: Ended.");
}
private static void cleanupThreadStart(object state)
{
Thread mainThread = (Thread)state;
Console.WriteLine("cleanupThreadStart: Waiting for main thread to exit.");
mainThread.Join();
Console.WriteLine("cleanupThreadStart: Ended.");
}
Oddly, this solution works from within VS when I start with debugging (F5), meaning that the main thread will end and the cleanup thread will complete the join and I'll see the console printout. However if I start without debugging (ctrl+F5 or simply run the executable directly) the program hangs because the main thread ends but the cleanup thread never completes the Join. I've tried attaching to the process from within VS during the hang and I can see that the main thread is no longer present but the cleanup thread is still waiting for the Join to complete.
Does anybody know why this works with debugging active but not without it? Does anybody have any other clever way of detecting that the application is about to end (similar to Application.ApplicationExit)?
For now I've got a workaround to just create my own "main" thread which executes the normal application code. Then my cleanup thread joins with this thread before cleanup. This seems to work fine.
|
|
|
|
|
I'm interested in this sort of thing myself - one of the things I found was
class Program
{
static void Main(string[] args)
{
AppDomain.CurrentDomain.ProcessExit += new EventHandler(CurrentDomain_ProcessExit);
<pre>
}
static void CurrentDomain_ProcessExit(object sender, EventArgs e)
{
Console.WriteLine("exit");
}
}</pre>
Im also working on handling the Ctrl/C, Ctrl/Break, 'X' to detect app shutdown as well
|
|
|
|
|
When the debugger is attached, it will keep the main-thread alive, since you're debugging. Without the debugger, the main-thread is halted. The application will close as soon as all foreground threads close.
There is no event that says that a console-application is about to be aborted with Ctrl-C. The mainthread is simply terminated; hence it will not execute any events.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Reg
modified 26-Aug-16 5:43am.
|
|
|
|
|
What have you tried?
Where are you stuck?
What help do you need?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Message Closed
modified 26-Aug-16 5:46am.
|
|
|
|
|
So start with Google, and see what you can find: we aren't a "code-to-order" service - we expect you to put in some effort!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Needs to change his name to "how to" - see his message list.
|
|
|
|
|
Ah. I see - a Help Vampire.
At a guess, he got employed in a job he can't do and is trying to wing it without learning anything...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Dear Sir,
I have not asked you to provide me the code. Thanks for your cooperation.
|
|
|
|
|
|
Next time will take care of these points.
Thanks..!!
|
|
|
|