SqlCeException Does Not Inherit From DbException

Apr 10, 2008

I'm in the middle of developing some database independent code and I am surprised to find that the SqlCeException inherits from System.Exception not DbException. The argument I have seen is that DbException does not exist in the CE framework which I understand but this clearly breaks the model laid out by the other assemblies in the data namespace.

My issue is that I have a library which accepts an object implementing the IDBCommand. The execute command is wrapped in a try catch which is only interested in a DbException and allows all other exceptions through which therefore will allow and SqlCeException through.

I have three options available to me:


Catch all exceptions - This is not acceptable as other exceptions need to bubble up to the calling code.

Explicitly catch an SqlCeException - This too is not acceptable as it is a common library and not every application wants a reference to the SqlCe assembly

Explicitly catch an SqlCeException outside of the method call - As hideous as it is this is the only viable solution available to me meaning that any calling code using an SqlCeCommand must be aware of this "feature".
If anyone else has a suggestion I am willing to listen otherwise I'm going to go back to banging my head against the wall.</rant>

View 3 Replies


ADVERTISEMENT

DBException (Communication Link Failure)

Jul 20, 2005

Hi,with SQL 2000 and Windows 2000, we're getting lots of this error message"Communication link failure" from our C++ application.Any idea why?Thanks,

View 2 Replies View Related

SqlCeException - The Column Name Is Not Valid

Feb 12, 2008



Hello Everybody

I'm getting a strange error.
I have created a Datatable and in this table I have multiple Columns.
I have given them all a name and now when I want to put data in the DataTable I get a error.
All goes well until I try to Update the Datatable






Code Snippet
DataRow DrWb = ppcDbDataSet.Item.NewRow();
DrWerkbon["ItemNummer"] = Defines.mcItem.miItemNr;
DrWerkbon["WorkerNummer"] = Defines.mcWorker.msWorkerNr;
Defines.mcItem.msWorkerNr = Defines.mcWorker.msWorkerNr;
DrWerkbon["CustomNummer"] = Defines.mcCustom.msCustomNr;
Defines.mcItem.msCustomNr = Defines.mcCustom.msCustomNr;
DrWerkbon["WbRedenBezoek"] = edRedenBezoek.Text;
Defines.mcItem.msReason = DrWb["WbReason"].ToString();
ppcDbDataSet.Item.Rows.Add(DrWerkbon);
ItemTableAdapter.Update(DrWb);
ppsDbDataSet.Clear();
ItemTableAdapter.Fill(ppcDbDataSet.Item);




At the ItemTableAdapter.Update(DrWb) it gives the error:

SqlCeException was unhandled
The Column name is not valid. [ Node name (if any) = , Column name = WbReason ]

I don't understand why it is giving this error because the name of the column realy is WbReason

Does anybody know what to do about this??

Kind regards

Korsten



View 3 Replies View Related

Inherit From Executepackagetask

Jan 2, 2007

Hi,

is there a way to inherit from ExecutePackageTask? I try to build my own control flow component, mainly doing the same as the named task, with some special logging and configuration.

Application.LoadPackage(); Package.Execute(); Execute the Packages, but IMHO dont have the ability to jump into the package and show up the flow in the BI-Studio DebugMode.

So I will give it a try to inherit from ExecutePackageTask and customize the behavior.

Thanks

Thorsten

View 1 Replies View Related

Database Design, Inherit

Jul 23, 2005

I have a database that looks something like this:Table: CreatureFields, CreatureId {PK}, ...Table: BugFields: BugId {PK}, CreatureId {FK}...Table: LadyBirdFields: LadyBirdId {PK}, BugId {FK}...Every creature in the system is in the Creature-table. If the creaturealso is a bug, then it's also in the bug table. And if it's aLadyBird, it's also in the LadyBird-table.A problem with the current design is that several bugs could be of thesame creature, and several LadyBirds could be of the same bug whichshould not be possible.So I'm thinking about removing the fields BugId and LadyBirdId, anduse CreatureId (as primary key) instead in the bug and ladybird table.Would that improve the design of the database? With a new design it'spossible to have a LadyBird that's not a Bug.I still thinks the new design would be better, but I'm gladly acceptadvices before I starts the redesign (which will be quite some work todo :-/ )PEK

View 2 Replies View Related

'SqlCeException - A Parameter Is Missing' After Migration To SQLServerCompactEdition 3.5

Jan 21, 2008

Hi,

after migration my project to CF 3.5 and SQlCe 3.5 I got the following error message:

System.Data.SqlServerCe.SqlCeException - A parameter is missing. [ Parameter ordinal = 1 ]

I'm using the same code:

Public Sub Update(oSqlCEConn As SqlCeConnection, oSqlCEAdapter As SqlCeDataAdapter, dt As DataTable)
...
Dim cmd As SqlCeCommand = New SqlServerCe.SqlCeCommand
cmd.Connection = oSqlCEConn
cmd.IndexName="UK_IVCTAMOBILE"
cmd.CommandText="INSERT INTO IVCTAMOBILE(PKey,Status,Dfu,Lu,BusinessModified,BusinessModified_T,IvcTAMetaPKey,InitiationDate,IvcMainPKey,Accounted,Amount,SdoMainPKey,BpaMainPKey,PaymentMethod,InitiationDate_T) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
oSqlCEAdapter.InsertCommand=cmd
oSqlCEAdapter.Update(dt)
...
End Sub

I migrated the Database with this program:

Public Sub Upgrade(DB)
Dim sPath As String
Dim engine As System.Data.SqlServerCe.SqlCeEngine
sPath = System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase
sPath = sPath.Substring(0, sPath.LastIndexOf(""))
engine = New System.Data.SqlServerCe.SqlCeEngine("Data Source=" & sPath & "Test.sdf")
engine.Upgrade()
MsgBox("Finished")
End Sub

Any ideas?

Thanks,
Stefan

View 12 Replies View Related

Does NULL Inherit A Datatype After Convert

Jun 16, 2015

i have a little confusion...

DECLARE @name varchar(30)
SET @name = NULL
SELECT ISNULL(CONVERT(DATE,@name),'')
Result: 1900-01-01

But..

DECLARE @name varchar(30)
SET @name = NULL
SELECT ISNULL(@name,'')

Does NULL inherit a datatype after convert?

View 7 Replies View Related

System.Data.SqlCeException Native Error= 25011

Oct 31, 2007



I am getting the above error if i try to access sqlce3.0 database from an application which already uses sqlce2.0,
this error happens while initializing the sqlcecommand object
I hope the reason might be executing the the sqlcecommand through a sqlce2.0 engine on a sqlce3.0 database,

But I tried installing the sqlce3.0 in the PDA , still I am getting the same error

I would be thankfull if anyone could solve this

Thanks
Varadan

View 1 Replies View Related

Table Name Is Not Valid Sqlceexception During Merge Replication Initialization

Apr 21, 2008

During merge replication initialization from SQL Server 2005 to SQL Server CE 3.5 on Windows Mobile 5.0

I am getting the following errors:




On Device
{"The table name is not valid. [ Token line number (if known) = 1,Token line offset (if known) = 21,Table name = COLLECTION ]"}
base {System.SystemException}: {"The table name is not valid. [ Token line number (if known) = 1,Token line offset (if known) = 21,Table name = COLLECTION ]"}
HResult: -2147217900
Message: "The table name is not valid. [ Token line number (if known) = 1,Token line offset (if known) = 21,Table name = COLLECTION ]"
NativeError: 26100
Source: "Microsoft SQL Server Compact"

{System.Data.SqlServerCe.SqlCeError: The SQL statement failed to execute. If this occurred while using merge replication, this is an internal error. If this occurred while using RDA, then the SQL statement is invalid either on the PULL statement or on the SubmitSQL statement. [ SQL statement = ALTER TABLE [dbo].[COLLECTION] ADD CONSTRAINT [PK_COLLECTION] PRIMARY KEY CLUSTERED ( [SERIAL_NUMBER], [STORE_CODE], [COLLECT_DATE] )WITH PAD_INDEX , FILLFACTOR = 90 ]}
Source: "Microsoft SQL Server Compact"








Server Logged:
...
2008/04/20 20:03:16 Thread=EA0 RSCB=5 Command=SCHK Hr=00000000 SyncCheck responding 0
2008/04/20 20:03:17 Thread=B90 RSCB=5 Command=OPNR Hr=00000000 End Of Data Set 1
2008/04/20 20:03:17 Thread=B90 RSCB=5 Command=OPNR Hr=00000000 Responding to Fetch, bytes = 50259
2008/04/20 20:03:17 Thread=970 RSCB=5 Command=CLOS Hr=00000000 Total Compressed bytes out = 50259
2008/04/20 20:03:17 Thread=970 RSCB=5 Command=CLOS Hr=00000000 Total Uncompressed bytes out = 390254
2008/04/20 20:03:17 Thread=970 RSCB=5 Command=CLOS Hr=00000000 Removing this RSCB 0
2008/04/20 20:03:19 Hr=00000000 Compression Level set to 1
2008/04/20 20:03:19 Hr=80004005 ACK:Error for DistributorSessionID = 80
2008/04/20 20:03:19 Hr=80004005 The SQL statement failed to execute. If this occurred while using merge replication, this is an internal error. If this occurred while using RDA, then the SQL statement is invalid either on the PULL statement or on the SubmitSQL statement. [,,,SQL stateme 28560









The same tables in a different on a different SQL box (test) replicate fine, but on this box (production) they do not. Any idea what would be the difference in the two environments?

I suspect that the "dbo." part in the "alter table" is what it is messing up on... how can I tell SQL CE not to include that schema prefix?
Thanks

View 12 Replies View Related

Tables Created By SELECT INTO Inherit Parent Table Constraints!

Feb 1, 2008

Hey there,
Trying to build a temporary table based on a parent table such that:select * into #staging from tbl_parent where 1=0
The temp table (#staging) picks up any NOT NULL constraints from the parent (tbl_parent) table and frankly, it doesn't meet my needs.I also tried to build a view of the parent (tbl_parent) table from which to base my SELECT INTO and still, the constraints followed.
I'm thinking perhaps it possble to iterate though the temp table using syscolumns sysobjects and and set the column NULL properties on the temp table AFTER its been created but in this approach, I'm working to avoid directly referencing the columns by name.
Is this possible?  A better answer perhaps?
Purpose of exercie is to populate a record in memory before it hits the table.I'll be constructing the record on the fly so that at first, I won't have all the fields to de-Null the columns.Also, I don't wish to lose the fact that some of my fields are Null - once I've fully populated my temp record, I'll insert into my 'real' table and will depend on constraints to throw the appropriate error.  In this I won't have to built custom error checking in the stored procedure itself but instead depend on SQL SERVERS built capacity to the throw the error.  This opens a bunch of possibilities for extensibility since if at a later date a constraint rule changes, one need only change the parent table definition rather than cracking open the stored procedure.
Thank you for reading and a big thanks to you for replying :)
Also,
 

View 11 Replies View Related

Compact Framework SqlClient Classes Don't Actually Inherit From System.Data.Common.Db* Classes?

May 23, 2007

As you all know, in Framework 2.0 on the desktop platform you have the convenient "abstract" Db* classes that can be used to write more generic code. For instance System.Data.SqlClient.SqlConnection inherits from System.Data.Common.DbConnection, and so forth. Now the docs clearly say that this applies to the corresponding classes in the Compact Framework. And i have seen this implied by other web searchs I've done. However this does not seem to be the case -- or, I'm missing something somewhere.

The following simple code on the desktop platform compiles OK:

using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
DbConnection conn = new SqlConnection();

However it doesn't compile in a compact framework project: "Cannot implicitly convert type 'System.Data.SqlClient.SqlConnection' to 'System.Data.Common.DbConnection'".

Reflector also indicates that the Compact Framework class doesn't inherit from DbConnection.

OK, so am I missing something here, or what was the reason that Microsoft did it differently??

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved