S
SSP
Hi all,
I have an application on PPC 2003 which contains a form used to enter some
data into a SQL CE db.
The db contains a table like this:
___________________
cNSA nvarchar (50),
cCN nvarchar (50),
cVN int
--------------------------
Below is a snippet of the code used to enter data into the db where cVN_tb,
cNSA_tb, cCN_tb are textboxes.
when I hit the submit button the I get the error:
________________________________________________________________________
An unhandled exception of type 'System.FormatException' occurred in
System.Windows.Forms.dll
Additional information: FormatException
The thread '<No Name>' (0x61734) has exited with code 0 (0x0).
The thread '<No Name>' (0x24a7e4) has exited with code 0 (0x0).
The program '[2448] rundll32.exe: PRSSForms.exe' has exited with code 0
(0x0).
___________________________________________________________________________
When check the contents of the database, the cVN column (integer column)
manages to get the data, but the nvarchar columns cause the above error.
CODE:
___________________________________________
cmd.Parameters.Add(new SqlCeParameter("p1", SqlDbType.NVarChar));
cmd.Parameters.Add(new SqlCeParameter("p2", SqlDbType.NVarChar));
cmd.Parameters.Add(new SqlCeParameter("p3", SqlDbType.Int));
cmd.Prepare();
int vFN;
vFN = Convert.ToInt32(cVN_tb.Text);
string cNSA_tb_conv;
cNSA_tb_conv = Convert.ToString(cNSA_tb.Text);
string cCN_tb_conv;
cCN_tb_conv = Convert.ToString(cCN_tb.Text);
cmd.Parameters["p1"].Value = cNSA_tb_conv;
cmd.Parameters["p2"].Value = cCN_tb_conv;
cmd.Parameters["p3"].Value = vFN;
cmd.ExecuteNonQuery();
_______________________________________________
Any ideas anyone??
SSP
I have an application on PPC 2003 which contains a form used to enter some
data into a SQL CE db.
The db contains a table like this:
___________________
cNSA nvarchar (50),
cCN nvarchar (50),
cVN int
--------------------------
Below is a snippet of the code used to enter data into the db where cVN_tb,
cNSA_tb, cCN_tb are textboxes.
when I hit the submit button the I get the error:
________________________________________________________________________
An unhandled exception of type 'System.FormatException' occurred in
System.Windows.Forms.dll
Additional information: FormatException
The thread '<No Name>' (0x61734) has exited with code 0 (0x0).
The thread '<No Name>' (0x24a7e4) has exited with code 0 (0x0).
The program '[2448] rundll32.exe: PRSSForms.exe' has exited with code 0
(0x0).
___________________________________________________________________________
When check the contents of the database, the cVN column (integer column)
manages to get the data, but the nvarchar columns cause the above error.
CODE:
___________________________________________
cmd.Parameters.Add(new SqlCeParameter("p1", SqlDbType.NVarChar));
cmd.Parameters.Add(new SqlCeParameter("p2", SqlDbType.NVarChar));
cmd.Parameters.Add(new SqlCeParameter("p3", SqlDbType.Int));
cmd.Prepare();
int vFN;
vFN = Convert.ToInt32(cVN_tb.Text);
string cNSA_tb_conv;
cNSA_tb_conv = Convert.ToString(cNSA_tb.Text);
string cCN_tb_conv;
cCN_tb_conv = Convert.ToString(cCN_tb.Text);
cmd.Parameters["p1"].Value = cNSA_tb_conv;
cmd.Parameters["p2"].Value = cCN_tb_conv;
cmd.Parameters["p3"].Value = vFN;
cmd.ExecuteNonQuery();
_______________________________________________
Any ideas anyone??
SSP