Various questions
-
- Posts: 38
- Joined: Fri 23 Dec 2005 11:51
Various questions
I have managed to adapt the pitcures example's structure in my app to allow me to update data to MYSQL. The app takes images , text, date stamp etc. I then store all the data inc paths into a text file. I then populate the grid with data and images and update the tables.
Any pointers on the following appreciated.
The text file method works but I need to "hide" the text file. (End users cannot alter times etc for security reasons)
My app loads Form1 which contains a Updatebutton to "mySqlConnection.Open();" I then update on "mySqlConnection_StateChange". The app crashes if there is no connection. How Do I trap this error eg
if (mySqlConnection.State. 'failed') { close form}. Also is there a way to say "Press Updatebutton on form1" without opening the form.
Any sample c# code to force an internet connection if not available?
How do I put a splash screen after a button press. I have:
Form1 form1 = new Form1();
form1.Show();
but the screen take a while to update. How do I say "Loading please wait" and shut this down once the form is loaded.
I have no problems when connected via activesyn. I have done 100+ rows and the data flys. However when using GPRS I get a lost connection and only part of the data is sent across. The end user may be dropping out of service whilst moving. Any strategies for handling this sort of problem.
Many thanks for the help so far.
Any pointers on the following appreciated.
The text file method works but I need to "hide" the text file. (End users cannot alter times etc for security reasons)
My app loads Form1 which contains a Updatebutton to "mySqlConnection.Open();" I then update on "mySqlConnection_StateChange". The app crashes if there is no connection. How Do I trap this error eg
if (mySqlConnection.State. 'failed') { close form}. Also is there a way to say "Press Updatebutton on form1" without opening the form.
Any sample c# code to force an internet connection if not available?
How do I put a splash screen after a button press. I have:
Form1 form1 = new Form1();
form1.Show();
but the screen take a while to update. How do I say "Loading please wait" and shut this down once the form is loaded.
I have no problems when connected via activesyn. I have done 100+ rows and the data flys. However when using GPRS I get a lost connection and only part of the data is sent across. The end user may be dropping out of service whilst moving. Any strategies for handling this sort of problem.
Many thanks for the help so far.
-
- Posts: 38
- Joined: Fri 23 Dec 2005 11:51
Syntax
What is the exact syntax please
{
if mySqlConnection.Ping() = true {
MessageBox.Show("connected ");
}
}
does not work
Cheers
{
if mySqlConnection.Ping() = true {
MessageBox.Show("connected ");
}
}
does not work
Cheers
-
- Posts: 38
- Joined: Fri 23 Dec 2005 11:51
Trap connection error
I call
mySqlConnection.Open();
if (mySqlConnection.Ping() == false)
{
MessageBox.Show("not connected");
mySqlConnection.Close();
}
to try and trap a no connection error but the pocket PC gives a "no connection to server "error dialog.
How do I trap this error please?
SteveW
mySqlConnection.Open();
if (mySqlConnection.Ping() == false)
{
MessageBox.Show("not connected");
mySqlConnection.Close();
}
to try and trap a no connection error but the pocket PC gives a "no connection to server "error dialog.
How do I trap this error please?
SteveW
Code: Select all
{
if mySqlConnection.Ping() = true {
MessageBox.Show("connected ");
}
}
-
- Posts: 38
- Joined: Fri 23 Dec 2005 11:51
Syntax
I have the syntax correct now, but the code above does not trap the error if the is no connection. IE no gprs / activesync connection to MYSQL.
Cheers
SteveW
Cheers
SteveW
-
- Posts: 38
- Joined: Fri 23 Dec 2005 11:51
try
I have
try
{
mySqlConnection.Open();
}
catch (Exception)
{
MessageBox.Show("Error");
}
finally
{
rest of code to update images etc
}
The above code captures the execption if not connected, but after clicking the message box I get the error connection must be openend. I thought the finally section only runs if there is no exeption. How do I stop the code running?
try
{
mySqlConnection.Open();
}
catch (Exception)
{
MessageBox.Show("Error");
}
finally
{
rest of code to update images etc
}
The above code captures the execption if not connected, but after clicking the message box I get the error connection must be openend. I thought the finally section only runs if there is no exeption. How do I stop the code running?