|
what do you mean by saying message shown is of system.FormatException.
can you post the code and exception message
may this help
|
|
|
|
|
Following is the code that I am running in a clikc event of a button followed by the message that I am getting when the exception is caught.
private void bttnSaveUserPersonalInfo_Click(object sender,EventArgs e)
{
DataRowView drwNewUserPersonalInfo;
string strUserRoles = String.Empty;
try
{
drwNewUserPersonalInfo = dvUserPersonalInfo.AddNew();
drwNewUserPersonalInfo[0] = txtUserLoginID.Text;
drwNewUserPersonalInfo[1] = txtUserLoginPassword.Text;
drwNewUserPersonalInfo[2] = txtUserLastName.Text;
drwNewUserPersonalInfo[3] = txtUserFirstName.Text;
drwNewUserPersonalInfo[4] = txtUserMiddleName.Text;
drwNewUserPersonalInfo[5] = txtUserDateOfBirth.Text; drwNewUserPersonalInfo[6] = txtUserSSNumber.Text;
drwNewUserPersonalInfo[7] = cboUserMaritalStatus.SelectedValue.ToString();
drwNewUserPersonalInfo[8] = cboUserSex.SelectedValue.ToString();
drwNewUserPersonalInfo[9] = txtUserNationality.Text;
drwNewUserPersonalInfo[10] = txtUserAliasName.Text;
drwNewUserPersonalInfo[11] = txtUserCurrentLocale.Text;
drwNewUserPersonalInfo[12] = Session["UserID"].ToString();
drwNewUserPersonalInfo[13] = DateTime.Now;
drwNewUserPersonalInfo[14] = Session["UserID"].ToString();
drwNewUserPersonalInfo[15] = DateTime.Now;
drwNewUserPersonalInfo.EndEdit();
dstUserPersonalInfo.WriteXml(MapPath"./DataBase/UserPersonalDetails.xml"));
ViewState["NewUserLoginID"] = txtUserLoginID.Text;
}
catch(System.ArgumentException) //This exception is caught the message *
{
Response.Write(x.Message);
}
}
//Message displayed when ArgumentException is caught
System.FormatException: String was not recognized as a valid DateTime. at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles) at System.DateTime.Parse(String s, IFormatProvider provider, DateTimeStyles styles) at System.DateTime.Parse(String s, IFormatProvider provider) at System.Convert.ToDateTime(String value, IFormatProvider provider) at System.String.System.IConvertible.ToDateTime(IFormatProvider provider) at System.Convert.ToDateTime(Object value) at System.Data.Common.DateTimeStorage.Set(Int32 record, Object value) at System.Data.DataColumn.set_Item(Int32 record, Object value)Couldn't store <> in USER_DOB Column. Expected type is DateTime.
Plz review this code try to get the solution.
Thankin u
|
|
|
|
|
|
Thanks,
But I dont get what do u want to say.
whats the relation between the exception I am getting and the code u sent to me.
I dont think there is any relation between the two exceptions formatexception and argumentexception.
i just want to know why the proper exception is not caught.
|
|
|
|
|
Hi there!
I managed to make a service and then made a setup project for it.The set up worked fine on my PC but when i tried to install this service on another PC i came up with an error while trying to start the service "Error:1053 The service did not respond to start or control request in a timely fashion".
This error did not come after 3 minutes rather it came as soon as the service was tried to be started.
Plz help me in this matter.
Regards
Asif Rogers
asifrogers
|
|
|
|
|
Using C# forms and graphic box.
I am looking for help creating a form in which i have a graphic box. In the graphic box I can load an image that is 1024x768 in size. I want to be able to add a graphic and lock it by the x, y cord, on top of the other graphic in a seperate plane. Is this possible and does anyone have any ideas on how to make this easy to code and stable?
Rob
|
|
|
|
|
Is a graphic box a picture box ? If you want to draw images in layers, you need to do it yourself.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
yes.. its a picture box. The standard in c# VS. But what im trying to do is have two seperate immages float on top of each other, so i can click each seperatly and have seperate objects. The locations will load from a sql db of where to snap to. How can this be done?
|
|
|
|
|
Anonymous wrote:
The standard in c# VS.
Well, the quick and easy way, at least.
Anonymous wrote:
How can this be done?
Like I said, you need to draw the images yourself. Handle OnPaint and draw them there.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
hi,
i've already added a control with an image in my toolbar but the image disappears when i run my app.. why is that so?
thanks
|
|
|
|
|
I would like to have clients call some kind of an enqueue web method and wait for a server response. I was hoping someone could tell me the correct threading code to accomplish this.
Client > [WebMethod]public string Wait() > [Client thread waits] > Server fires "RETURN" >
Client returns "RETURN"
Anyone know how to do this?
|
|
|
|
|
|
|
Hi
I have Class A with a protected virtual member Method1() and i have another calss Class B inheriting Class A in which i overrided the base class's method Method1() and i also call the base class's Method1() using the base keyword. Now i have another class Class C which inherits Class B and i am overriding Method1(), the problem is now how do i call Class A's Method1() from this class.
<br />
Class A<br />
{<br />
protected virtual Method1()<br />
{}<br />
}<br />
<br />
Class B : Class A<br />
{<br />
protected override Method1()<br />
{<br />
base.Method1()<br />
}<br />
}<br />
<br />
Class C : Class B<br />
{<br />
protected override Method1()<br />
{ <br />
QUESTION: HOW TO CALL CLASS A's METHOD1() HERE. I dont want to call Class B's Method1() but want to call Class A's Method1()<br />
}<br />
}<br />
F1! F1! F1!....plzzz
Regards
Chettu.
|
|
|
|
|
You can't do it directly in C# because B has already overridden Method1. You need to have a protected "forwarding" method in class B that does what you want to. Something like
class B : A
{
protected void ForwardMethod()
{
base.Method1();
}
}
It's possible in C++ though, A::Method1 will do the job.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
You can't, and it would suck if you could. Looks like C should derive from A.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Why would it suck.. i have a case where Class C should inherit Class B and not A isn't this a possible scenario... i guess so....The possible solution i have done is have a method in class B which will call the base method in A. This scenario will hold in events.. where calling the base class is mandatory....
|
|
|
|
|
chettu wrote:
i have a case where Class C should inherit Class B and not A isn't this a possible scenario
No, because if inheritance is optional, how could you count on it in any way ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi
This is for a windows application in C#. I am using a PrintDialog and a PrintPreviewDialog. When I go through the PrintDialog my document prints correctly. When I use the PrintPreviewDialog the preview is correct. However when I click the print icon on the Preview dialog the printer only pushes out a blank paper. Is there anything that I need to specify in the PrintPreviewDialog?
Thanks
Kobus
|
|
|
|
|
You are not setting the Document property of the PrintPreviewDialog for sure. Please check.
Live Life King Size
Alomgir Miah
|
|
|
|
|
i am using remote data access for my project. this is my code.
private void button2_Click(object sender, System.EventArgs e)
{
SqlCeConnection cn = null;
SqlCeRemoteDataAccess rda= null;
SqlCeEngine sqlEngine=null;
try
{
button2.Enabled=false;
//Create database if it doesn't already exist
if(!File.Exists("\\My Documents\\Student.sdf"))
{
sqlEngine=new SqlCeEngine( );
sqlEngine.LocalConnectionString="Data Source=\\My Documents\\"+
"Student.sdf;"+
"Password= ;"+
"Encrypt Database=True";
sqlEngine.CreateDatabase();
sqlEngine.Dispose();
}
else
{
//open the connection to the database
cn=new SqlCeConnection("Data Source=\\My Documents\\"+
"Student.sdf; Password=");
cn.Open();
SqlCeCommand cmd=cn.CreateCommand();
//drop table tutorial1_Classlist
cmd.CommandText="DROP TABLE tutorial1Class_list";
cmd.ExecuteNonQuery();
//close the conection
if(cn.State!=ConnectionState.Closed)
{
cn.Close();
}
}
//Instantiate the RDA Object
rda=new SqlCeRemoteDataAccess();
//Connection String to the Sql Server
string remoteConnectString="Provider=SQLOLEDB;"+
"Data Source=IT768P27;"+
"Initial Catalog=Student;"+
"User Id=sa;" +
"Password=";// empty password
rda.InternetLogin="";
rda.InternetPassword="";
rda.InternetUrl="http://IT768P27/StudentRDA/sscesa20.dll";
rda.LocalConnectionString="Data Source=\\My Documents\\"+
"Student.sdf;"+
"SSCE:Database Password=";
rda.Pull("tutorial1Class_list", "Select * from tutorial1Class_list",
remoteConnectString,RdaTrackOption.TrackingOn);
}
catch(SqlCeException sqlex)
{
foreach(SqlCeError sqlError in sqlex.Errors)
{
MessageBox.Show(sqlError.Message,"Error");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message,"error");
}
finally
{
rda.Dispose();
button2.Enabled=true;
}
}
when i run it in my pocketpc ,it give me error like "sql server ce encountered problems in creating the sql server ce database[...connection string..]..
what should i do.. i c every codeing is all right. can u tell me what is wrong with my connection string?
|
|
|
|
|
I see that no one ever replied to this....I hope you found the answer!
But if not...the RDA connection expects IIS at the receiving end. //MyDocuments// is not a well-formed URL for going to a web server.
However if you have IIS running then at a minumum your web would be something like:
"http://myMachineName/SqlHost" assuming your RDA host connection
is in the web SqlHost.
So you need your host name and web name for a well structured IIS connect to your database.
There are 10 kinds of people in the world.
Those that read binary...
...and those who don't.
|
|
|
|
|
Hi.I need to work with Calendar Control .Can you show me where can I find any good tutorials or examples on this topic .Thank you
|
|
|
|
|
I would suggest that you got voted a 1 for two reasons
1. 'How can I' is not a decent way to head your question, I thought you'd posted the same question twice
2. Google will answer both of these questions in seconds.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi.Can you show me any tutorial about editing the information of a database which is shown in datagrid.I need to add ,delete,update information interacting only with the grid.Thank you
|
|
|
|