VS2008 string format problem for SQLCE db

ripon

Member
Joined
Mar 23, 2006
Messages
15
Programming Experience
Beginner
I have created a table mytable in SQLCE which 2 colums col1 ,col2.
col1 = numeric,Length 5, Allow Nulls=No,Unique=No,Primary Key=Yes.
col2 = nvarchar,Length 35, Allow Nulls=No,Unique=No,Primary Key=No.

In my VS2008.Net3.5 VB code:
Dim outletInsertCmd As SqlCeCommand

outletInsertCmd.Parameters.Add("?", SqlDbType.Float, 9, "col1")-------------------
outletInsertCmd.Parameters.Add("?", SqlDbType.NVarChar, 35, "col2")--------------

Dim curOutletRow As DataRow

curOutletRow.Item("col1") =0 'This works fine
curOutletRow.Item("col2") ="ABA" ====Giving error as Format Exception.
--I think I am wrong in passing String from .Net to SQLCE. What should be the code.
I tried:curOutletRow.Item("col2") ="'ABA'"===Does not work
curOutletRow.Item("col2") =Convert.ToString("ABA")===Does not work

--Please help me. Thanks
 
Please post in the most appropriate forum for the topic, not just the first one you come to.

At a guess I'd say that it's because you're trying to add two parameters with the same name. "?" is not a suitable name for a parameter and it's certainly not a suitable name for two different parameters. Use unique, descriptive names. That may or may not fix your problem but it's sound advice regardless.
 
Back
Top