|
Hey, thanks for the response.
But I have tested the recursive function, it depth is max. 10 in all cases and I pass 2 integers each time. And important of all, it is running OK when I shut down all nonrecursive heavy routines running before it.
Somehow, there are pending methods left, raising the program proximity to the stack limit. Anyway, do you know how can I raise the stack limit ? Is it possible ?
FioFio
|
|
|
|
|
Hello and merry christmas
I want to convert my localtime (I'm living in Belgium) Format : DD/MM/YYYY HH:MM:SS with time of ntp server (Format : MM/DD/YYYY HH:MM:SS no AM/PM)
Can you help me ?
My best wishes.
Frédéric
|
|
|
|
|
I haven't tested this or anything, but I'm pretty sure all you need to do is use the ToString() method. For instance...
DateTime time = DateTime.Now;
string formattedTime = time.ToString("MM/dd/yyyy hh:mm:ss");
For more information, check out MSDN's custom DateTime format strings[^].
Michael Flanakin
Web Log
|
|
|
|
|
Hi,
Is there anyway I can set a timeout for an asynchronous call in remoting. The intention is that if the method takes a long time and it is not worth waiting that long, the execution should proceed. Kind of taking off the blocking aspect of EndInvoke call.
.kausthubh
|
|
|
|
|
Hi,
Ftp artical.I have a two questions
1: How to take backup of SQL Server 2000 Database in c# programm what
we write such that kind of code which run and take backup from db. You
understand what i mean to say.
2: We have a winform application in datagrid we show some data from sql
server 2000 database i need that when we change some thing in datagrid
the changing save into XML format and throuh ftp or mail we send this
file to remote computer and on the computer a other application runs
which take XML data and insert in the Sql Server 2000 Database which is running on remote PC.
Muhammad Waqas Butt
|
|
|
|
|
WaqasButt wrote:
1: How to take backup of SQL Server 2000 Database in c# programm what
we write such that kind of code which run and take backup from db. You
understand what i mean to say.
What was wrong with the answer[^] that I gave to you a few days ago? If you didn't understand it then I am more than happy to clarify anything. I did make some assumptions that you knew your way around the SqlConnection and SqlCommand objects well enough to perform a normal query (SELECT, INSERT, DELETE, UPDATE) so maybe that was incorrect.
Do you want to know more?
WDevs.com - Member's Software Directories, Blogs, FTP, Mail and Forums
|
|
|
|
|
I am using DrawString() method to draw a string content. I would like to highlight the text portion which I draw using DrawString(). Is there any way ?
Eg:
My Text Content
Sreejith Nair
[ My Articles ]
|
|
|
|
|
Probelm....
Main Application Form Code (mainfm)
-------------------------
static void Main()
{
Application.EnableVisualStyles();
Application.DoEvents();
Application.Run(new fmapppas());
}
----------------------
Password Verify Form (fmapppas)
==================
if(User not found)
{
Messagebox.Show("Waqas");
}
else
{
mainfm.show();
this.close();
}
1: Now the problem is when user verif than first main form show but
than both forms close means application close.
2: If i write Hide() on the place of Close() in password form then if still running in processes. and when i close main form with application.Exit(); this form close but application still running in prcoessess.
Please help Me..
Muhammad Waqas Butt
waqasb4all@yahoo.com
Muhammad Waqas Butt
waqasb4all@yahoo.com
|
|
|
|
|
Use your fmapppas() constructor to call login form. And try to execute your login related logic.That will be a good solution for this.
Sreejith Nair
[ My Articles ]
|
|
|
|
|
Thanks Buddy
Sorry didn't understand what you mean. I am new in C#.
Suppose i have two forms Main and Form2
Main is application main form.
So i call form2 in
static void Main()
{
Application.Run(new Form2());
}
than in form2 a button and onclick event i write
main.Show();
this.Close();
I need to close form2 and show main form.If you kindlly write a tell code that how can i write in my project.
I think you are online so if you help me no i try it no.
Thanks
Muhammad Waqas butt
|
|
|
|
|
public frm_MDI_Main_Parent()
{
InitializeComponent();
Login LogForm = new Login();
LogForm.ShowDialog();
}
static void Main(string[] args)
{
Application.Run(new frm_MDI_Main_Parent());
}
Sreejith Nair
[ My Articles ]
|
|
|
|
|
Hi Thanks for your help but i am not using MDI Application. So please tell me other solution.
Please...
Muhammad Waqas Butt
|
|
|
|
|
The problem is that the ApplicationContext MainForm of your application is the fmapppas form. That is because you are starting the applicatoin in this form with the code: Application.Run(new fmapppas());
When this form closes, u are exiting the application.
On the other hand, if u hide the fmapppas form, the application will keep on running forever because the user can't close the hidden form and thus finalize the application because there is no GUI available (would have to do it through the taskmanager).
Solutions: You should always use the application's main form as the ApplicationContext mainform: That is, start the app with the mainfm or set it as the ApplicationContext's MainForm if your using a custom application context:
[STAThread]
public static void Main()
{
Application.Run(new mainform())
}
then override the main forms OnLoad method and start the logging form from there:
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
fmapppas frm=new frmappas;
frm.ShowDialog(this);
}
If u really dont want to change the structure u have right now, u could probably fix your problem simply overriding the mainfm's OnClosed method and force the hidden form to close also:
protected override OnClosed(EventArgs e)
{
fmapppas.Close();
base.OnClosed(e);
}
|
|
|
|
|
i using this method to solve this problem
At first build a "Module" in the Solution
like this:
//===============
start.cs
//===============
using System;
using System.Windows.Forms;
namespace test
{
public class Start
{
public static string dbstr;
[STAThread]
static void Main()
{
FrmLogin frm = new FrmLogin();
if(frm.ShowDialog()==DialogResult.OK)
{
Application.Run(new FrmMain());
}
}
}
}
And build a Login Form to return a value to this module
//=================================
FrmLogin.cs
//=================================
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Diagnostics;
using System.Data.OleDb;
namespace test
{
///
/// FrmLogin
///
public class FrmLogin : System.Windows.Forms.Form
{
private System.Windows.Forms.Button login;
private System.Windows.Forms.TextBox uname;
private System.Windows.Forms.TextBox pwd;
private System.Data.OleDb.OleDbDataAdapter user;
private System.Data.OleDb.OleDbConnection conn;
private System.Data.OleDb.OleDbCommand oleDbSelectCommand1;
private System.Data.OleDb.OleDbCommand oleDbInsertCommand1;
private System.Data.OleDb.OleDbCommand oleDbUpdateCommand1;
private System.Data.OleDb.OleDbCommand oleDbDeleteCommand1;
private test.DSuser dSuser1;
private System.Windows.Forms.Button cancel;
///
///
///
private System.ComponentModel.Container components = null;
public FrmLogin()
{
//
//
//
InitializeComponent();
//
//this.conn.ConnectionString=Start.dbstr;
//
// TODO: 在 InitializeComponent //
}
///
///
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
private void login_Click(object sender, System.EventArgs e)
{
try
{
this.user.SelectCommand.Parameters["username"].Value=this.uname.Text.Trim();
this.user.SelectCommand.Parameters["password"].Value=this.pwd.Text.Trim();
this.dSuser1.Clear();
this.user.Fill(this.dSuser1);
if(this.dSuser1.user.Rows.Count>0)
{
this.DialogResult=DialogResult.OK;
}
else
{
MessageBox.Show("Bad User Name Or Password!");
this.uname.ResetText();
this.pwd.ResetText();
return;
}
}
catch(Exception ex)
{
Debug.Write(ex);
}
finally
{}
}
private void cancel_Click(object sender, System.EventArgs e)
{
this.DialogResult=DialogResult.Cancel;
}
}
}
When user input the right UN and PWD the Module will open the MainForm.
hope it will some help for you.
my english is poor
hehe
|
|
|
|
|
Remember
this keyword will close your that form which is showing your password form not your password form.....
|
|
|
|
|
Does any body tell me that how to get connection string from a app.config file or a xml file.
I mean i want that when me application start it pick db connection string from a file(any format like xml) and also user name and password. What code i have to write for reading connection string and writeing.
Please help me soon....
Thanks
Muhammmad Waqas Butt
waqasb4alll@yahoo.com
Muhammmad Waqas Butt
waqasb4alll@yahoo.com
|
|
|
|
|
Your xml file will be like this.
<configuration><br />
<appSettings><br />
<add key="ConnString" value="Your Connection String" /><br />
</appSettings><br />
</configuration></code><br />
<br />
<br />
You can use the above connection string value in your C# class provided you need to refer <code>System.Configuration in your class file.
using System.Configuration .Once you refer this namespace, then you can use below mentioned code to get the connection string into a string variable.
string ConnString=ConfigurationSettings.AppSettings["ConnString"];
Sreejith Nair
[ My Articles ]
|
|
|
|
|
Thanks Very Mush I try this and than i will tell you this code works or not. But I have a one more issue:
Probelm....
Main Application Form Code (mainfm)
-------------------------
static void Main()
{
Application.EnableVisualStyles();
Application.DoEvents();
Application.Run(new fmapppas());
}
----------------------
Password Verify Form (fmapppas)
==================
if(User not found)
{
Messagebox.Show("Waqas");
}
else
{
mainfm.show();
this.close();
}
1: Now the problem is when user verif than first main form show but
than both forms close means application close.
2: If i write Hide() on the place of Close() in password form then if still running in processes. and when i close main form with application.Exit(); this form close but application still running in prcoessess.
Please help Me..
Muhammad Waqas Butt
Muhammad Waqas Butt
|
|
|
|
|
Thanks for your DB Connection String Help this code works.
But Please also give me this answer
Main Form
--------------
Constructor Method
public fmmainform()
{
InitializeComponent();
fmapppas objfmappps = new fmapppas();
objfmappps.ShowDialog();
objfmappps.Activate();
this.Hide();
}
--------------
Password Form
-------------
if(user == null)
{
MessageBox.Show("Invaild Login\n Please Enter Correct Password",
"Login Error",
MessageBoxButtons.OK,
MessageBoxIcon.Information);
txtpass.Text = "";
txtpass.Focus();
}
else
{
this.Close();
}
-------------
Now Only Password Form Show But if i close Password form with doing work on it mean i close password form from the title bar closing button code
private void evtappclose(object sender, System.ComponentModel.CancelEventArgs e)
{
this.Dispose();
Application.Exit();
}
I want that if password verif than main form show but if user close password form without doing anything. Than application close.
[- The problem is When password is ok then else this.Close(); call now password closing event call than the whole application close. -]
Muhammad Waqas Butt
|
|
|
|
|
Hi
Well this is my first posting at CodeProject and in the past one month or so i had been actively using the codeproject site, it's vast expanse of knowledge base, code snippets and even full source code helps and samples has really impressed me a lot. Now i hope to remain an active member by submitting articles, posting and replying on quries.
here's my first query to the group
In a Web Browser control that i am using (C#.NET Windows app) i want to clear the history of pages that have been browsed, this being done at runtime may be at the hit of a button or after certain no. of pages have been browsed.
Any ideas there.
rgrds
the woods are lovely dark and deep.
but i have promises to keep.
there are miles to go before i sleep...
there are miles to go before i sleep...
|
|
|
|
|
Hi,
while connecting in the local machine there no porblem in the connection string. while connecting to the sql server from another machine through network. i got error of "login failed to uesr null". Sql Server is Windows authentication. Connection string is given below. what's the change need in connection string or sql server. bother machines are windows 2000. any one help to me.
strConnectionString = "Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=atc;Data Source=" + m_strServer + ";User ID=sa;Password=;";
Have A Nice Day!
Murali.M
|
|
|
|
|
The wonders of blank sa passwords
You say your SQL Server is windows authentication and then you supply a user (sa), which is a SQL User. Try removing it and ensuring that the application is running as a domain user.
This is not a C# question, please post in the appropriate forum.
|
|
|
|
|
Hi,
thanks for your reply. please make me clear. without providing user name and passport, the error occured then only trying this option. if posssible send an sample.
strConnectionString = "Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=atc;Data Source=" + m_strServer + ";";
you can make direct reply to murali_utr@vsnl.net also.
Have A Nice Day!
Murali.M
|
|
|
|
|
I believe you are missing "Trusted_Connection=true;", but even with this addition,
your connection string will only work if you are logged in as a member of the NT domain the server is running on (or a trusted domain) and that user or group has been granted access to the requested database.
Why would anyone waste time arguing with an accountant about anything? Their sole function is to record what happenned, and any higher aspirations are mere delusions of grandeur. On the ladder of productive contributions they are the little rubber pads at the bottom that keep the thing from sliding out from under you. - Roger Wright
|
|
|
|
|
Hi all,
I am design a three layer system in C# (view layer, business object layer
and data layer). But when I look into the J2EE infrastructure, the object
bean(business object) incorporates the SQL data function into the object itself. It seems violates the layer design principles coz it mixes the data layer with the business object layer. But in the other hand, it seems a more OO design coz the business object integrates all those related information into the business object, so when there is a later change in the business object specificiation, the developer needs to change only the business object instead of changing the object and the data layer.
So what approach should I choose ?
Thanks
|
|
|
|