the strange thing is, even when i create the database on my XP machine
(using C# and .NET code) , is still get the error when i want to insert a
record on the same machien
> Dieter,
>
[quoted text clipped - 35 lines]
>>>> kind regards
>>>> Dieter
Dieter - 10 Jul 2008 10:11 GMT
this is the complete exception
at
System.Data.Common.UnsafeNativeMethods.ICommandWithParameters.SetParameterInfo(IntPtr
cParams, IntPtr[] rgParamOrdinals, tagDBPARAMBINDINFO[] rgParamBindInfo)
at
System.Data.OleDb.OleDbCommand.ApplyParameterBindings(ICommandWithParameters
commandWithParameters, tagDBPARAMBINDINFO[] bindInfo)
at System.Data.OleDb.OleDbCommand.CreateAccessor()
at System.Data.OleDb.OleDbCommand.InitializeCommand(CommandBehavior
behavior, Boolean throwifnotsupported)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior
behavior, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteNonQuery()
> the strange thing is, even when i create the database on my XP machine
> (using C# and .NET code) , is still get the error when i want to insert a
[quoted text clipped - 39 lines]
>>>>> kind regards
>>>>> Dieter
Ginny Caughey MVP - 10 Jul 2008 11:38 GMT
Dieter,
That is strange. What does your code that inserts a record look like? Can
you reproduce the problem in a small sample that creates the database and
then inserts a row?
Ginny
> the strange thing is, even when i create the database on my XP machine
> (using C# and .NET code) , is still get the error when i want to insert a
[quoted text clipped - 39 lines]
>>>>> kind regards
>>>>> Dieter
Dieter - 10 Jul 2008 11:54 GMT
the code looks like this,
public void InsertMultisysRole_DLL(int roleId,int dllId)
{
OleDbConnection con = null;
OleDbCommand command = null;
string conString =
ConfigurationSettings.AppSettings["conString"].ToString(); ;
try
{
con = new OleDbConnection(conString);
command = new OleDbCommand();
command.Connection = con;
command.CommandText = " INSERT INTO
MultisysRoleDLL(DLLId,MultisysRoleId) VALUES (?,?)";
command.Parameters.Add(new OleDbParameter("DLLId", dllId));
command.Parameters.Add(new OleDbParameter("MultisysRoleId",
roleId));
con.Open();
command.ExecuteNonQuery();
}
catch (Exception ex)
{
throw ex;
}
finally
{
if (con != null)
con.Close();
}
}
> Dieter,
>
[quoted text clipped - 47 lines]
>>>>>> kind regards
>>>>>> Dieter
Ginny Caughey MVP - 10 Jul 2008 12:10 GMT
Dieter,
Why are you using OleDb from C#? Using a SqlCeConnection will work better
for you.
Ginny
> the code looks like this,
>
[quoted text clipped - 83 lines]
>>>>>>> kind regards
>>>>>>> Dieter
Dieter - 10 Jul 2008 12:19 GMT
because the same code also has to work against a full sql server
> Dieter,
>
[quoted text clipped - 92 lines]
>>>>>>>> kind regards
>>>>>>>> Dieter
Ginny Caughey MVP - 10 Jul 2008 13:00 GMT
Dieter,
If you need to build factory classes, use IDbConnection for the interface
code, but use the server-specific classes for actually accessing the data.
This gives you the best of both worlds. While you can get OleDb to work for
SQL Server, the OleDb provider for SQL Compact is not a complete OleDb
implementation and I don't get the sense that will change in the future.
Ginny
> because the same code also has to work against a full sql server
>> Dieter,
[quoted text clipped - 94 lines]
>>>>>>>>> kind regards
>>>>>>>>> Dieter
Dieter - 10 Jul 2008 14:24 GMT
ok i will do that
thx for the help
> Dieter,
>
[quoted text clipped - 104 lines]
>>>>>>>>>> kind regards
>>>>>>>>>> Dieter
Dieter - 10 Jul 2008 11:58 GMT
even a small program cause this error
> Dieter,
>
[quoted text clipped - 47 lines]
>>>>>> kind regards
>>>>>> Dieter