SqlCeConnection Guidelines - Keep It Open?
Feb 16, 2006
What is exactly the recommended way of using a SqlCeConnection object in your application?
In all the examples I see (IBuySpyDelivery for example) it opens the connection object in the constructor and leaves it open most of the time until the class gets disposed.
Is that the way to do it? Or should you open and close the connection for each database action (insert/select/delete) you're doing on the local SQL Mobile database?
I'm a bit confused, but maybe I'm messing up the way of working on remote database servers with how it should be done on a local SQL Mobile db.
View 7 Replies
ADVERTISEMENT
Aug 9, 2006
Help!
I am trying to implement a web service that creates and populates a SQL Mobile database file, then returns the created database to a mobile device as a byte array. The database size could be in excess of 500,000 rows, which is why I want to do as much of this preprocessing on the server before it gets to the mobile device. I can't use replication since I have to do some shaping of the data before I can use it on the mobile device.
Unfortunately, the web service is throwing the following exception when I try to instantiate a SqlCeConnection object:
"System.NotSupportedException: SQL Server Everywhere Edition is not intended for ASP.NET development."
Are there any suggestions as to how I can get around this potential limitation? If I refactor out the code that actually performs the SqlCe operations to a separate assembly, but still call that assembly from within the ASP.NET process, will I get the same error?
I know that you can work with Sql Mobile databases from the deskop, and I suppose I could invoke a console application to create the database, but that seems like such a hack.
Thanks for any advice,
Matthew
View 3 Replies
View Related
Dec 4, 2007
I'm having a problem where I am getting a "Permission denied" exception when I call Open on a SqlCeConnection object using SqlCE version 3.5. It does this when mode is set to Read Only in the connection string. Furthermore it does this on XP, but not Vista. Here is the connection string I'm building:
string connectionString = "Data Source='" + fileName + "';password=" + DBPassword + ";mode='Read Only';Temp File Directory='" + Path.GetTempPath() + "'";
A prompt response with a resolution to this would be greatly appreciated.
Ron
View 20 Replies
View Related
Jan 24, 2008
I know that with traditional SQL systems, it is important to only open connections to a sql server when they are needed. However, since there is no "server" in mobile apps, is it bad practice to leave one open throughout the duration of an application?
The application is going to be constantly reading and writing to the data tables and it seems like it might be a good idea to leave it open.
Thanks!
View 1 Replies
View Related
Apr 15, 2008
Good day,
I am writing an application using VB.Net 2005 for the Windows CE 5.0 device and it is connecting to a SQL Server 2005 Mobile Edition Database.
The trouble I'm having is establishing a connection to a SQL Server Mobile database on the device.
Here is the code I am using:
Code Snippet
Public gConnectionString As String = "Data Source=Program FilesMobAppMobDB.sdf;Persist Security Info=False;"
Code Snippet
Imports System.Data.SqlServerCe
Public Class DBManager
Public Shared gSQLCEConnection As SqlCeConnection
Public Shared Function OpenDB() As Boolean
If gSQLCEConnection IsNot Nothing Then
Throw New InvalidOperationException("Connection already open.")
End If
gSQLCEConnection = New SqlCeConnection(gConnectionString)
Try
gSQLCEConnection.Open() 'Error occurs here
Return True
Catch ex As SqlCeException
MsgBox(ex.Message & vbCrLf & ex.HResult & vbCrLf & ex.NativeError & vbCrLf & ex.Source)
Return False
End Try
End Function
In the immediate window I recieve the following messages:
A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll
A first chance exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll
A first chance exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll
A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll
A first chance exception of type 'System.Data.SqlServerCe.SqlCeException' occurred in System.Data.SqlServerCe.dll
I believe that the first few lines are caused by the icons/pictures that I have included with my app, but the SqlCeException line occurs when the connection to the .SDF file is trying to be established.
Here is the exception output:
Message: "" (Blank)
HResult: -2147024882
NativeError: 0
Source: SQL Server 2005 Mobile Edition ADO.NET Data Provider
Programs under Remove Programs on the PDA are:
Microsoft .NET CF 2.0 ENU-String R...
Microsoft .NET Compact Framework...
Microsoft SQL Client
Microsoft SQL Mobile 2005
Microsoft SQL Mobile 2005 [EN]
Microsoft SQL Server 2005 Compact...
Microsoft SQL Server 2005 Compact...
Microsoft SQL Server 2005 Compact...
Microsoft SQLCE 2.0
Microsoft SQLCE 2.0 Dev
Any ideas on what could be stopping this connection from being established? It was working before but all of a sudden just stopped. I have warm booted, cold booted, and rebuilt with no luck and also checked that SQL Query Analyzer is not running on the PDA and that the connection string is valid.
The call to OpenDB occurs in the form_load of the startup object.
Thanks in advance,
Leon
View 8 Replies
View Related
Jul 21, 2004
Hi folks, ya all are just fine i hope.
I've a question regarding indexes.
I've a table that is very often updated. My boss asked me to keep a log of each record when the table is updated. I've created an AFTER UPDATE trigger on the table and throw the old record into a log table on each update. The table would get large earlier. I want the updates on the original table fast, so i don't wanna add any kind of indexes on the log table. The log table will be scarcely queried only if the user has made a mistake and we want the old record back.
Now, i've column named event(DATETIME) log table that records CURRENT_TIMESTAMP. Should i create a clustered index on this column so the records get in sequence (the values in the column will be unique due to time and seconds being stored). I could be able to access records fastly in the log table on the basis of EVENT column. But how much it would cost the updates on the original table??
My major concern is to keep the updates on original table fast while logging the old records.
Usually it's said not to created indexes on date fields. Do i need to create non-clustered index or i am following the correct path.
Any tips and guidlines; highly appreciated.
Howdy!
View 4 Replies
View Related
May 31, 2007
hi all
i want to know the basic guidelines for developing and implementing and developing sql server database
Thanks in Advance
Malathi Rao
View 3 Replies
View Related
Jun 28, 2006
Hi All,
We have an application requirement for a database supporting field service engineers, which calls for a central SQL Server databse, and laptops with the same database replicated onto SQL Express. I'm resposible for designing the database for this, physical and logical. I've designed and built many a database, but never had to use replication before.
I've read through BOL, and understand how the merge replication process works, and I have no problem designing the database assuming it were to run on a single server.
What I am trying to find are whitepapers, or equivalent, on "best design and implementation practice", and especialy common mistakes to avoid.
I know that the windows programmers responsible for the UI will not completely abstract the database from the code (no matter how desirable that is or how often I tell them!), and I really don't want to find I have to change the physical tables or replication logic after they've coded most of the UI .
Many thanks in advance
Richard R
View 3 Replies
View Related
Jan 3, 2007
Hello all,
We have some doubts regarding NSTL guidelines for motorola Q. Our application is managed application. Which ocasionally connects to server. It is very helpful if we can get answers urgently.
Hopper Test €“ How can we make it run on Smartphone 5.0 (Motorola Q)? Is this tool only applicable for pocket pc 2003?
Application Verifier Test Tool €“ Is this tool only applicable for unmanaged code? If we are using .NET as the development environment, do we still have to use this tool?
Call Interupts €“ Is their a special way of handling Call Interrupts in the application or the default behaviour provided by the device (Moto Q) is OK?
Send Key (Green key) on the device €“ What is the expected behaviour of this key when the application is running? Do we have to handle it separately in the application
Is their a maximum space limit allowed for creation of the database files for an application?
Is their any specific utility like MaxfileCNT which NSTL uses for checking the behaviour of the application when there is no space available on the device?
thanks & regards,
Rashmi
View 3 Replies
View Related
May 3, 2004
We are about to change the sa password, currently all packages and jobs rely on this account. I imagine there is probably a better architecture that we could employ to ease this process. Any suggestions recommendations?
Also any caveats I should be aware of regarding places to look that might currently rely on the sa account so that we do not need to worry about existing processes from breaking?
I think we are going to create an NT account for DTS Packages and possibly use the same account for any DTSRun jobs, does this make sense? Or is there anything to gain by having these as separate accounts? Also should this be the same account used to run the MSSQLServer process?
I tried doing a search for this information here, thinking it was already covered, but could not find anything that informative, any resources that you could point me to would be appreciated, I will look on BOL as well as MSFT to see what I can dig up.
View 1 Replies
View Related
Apr 16, 2008
I am looking for guidelines for log file sizing, specifically where database reorgs are required
View 1 Replies
View Related
Nov 7, 2007
Good Morning, I've been searching through all the tutorials and questions, have tried many things. I am still getting "[SqlException (0x80131904): An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)]"
as an error. This is what I've got:
I€™m using SQL Server Express 2005, installed with the default settings. Had not touched this program for anything until I started to follow directions to fix Error 26. Visual Web Developer Express ASP.NET is what I€™ve used to build the webpage. I was using the ASP.NET web configuration to add users to the database, which is set to use the provider ASPSqlServerProvider.
SQL Server 2005 Surface Area Configuration
Database Engine Remote Connections €“ set to €śLocal and Remote Connections €“ Using TCP/IP Only€?
SQL Server Browser is Enabled and Running
- is set to Active, under Built In Account €“ Network Service
I have created Windows firewall exceptions for:
sqlservr.exe
sqlbrowser.exe
udp port 1434
SQL Server Configuration Manager
both SQL Server and SQL Server Browser are running.
Under SQL Server 2005 Network Configuration
Shared Memory and TCP/IP are enabled only.
SQL Native Client Configuration
Shared Memory 1
TCP/IP 2
Named Pipes 3
all enabled
I read through the post at http://blogs.msdn.com/sql_protocols/archive/2007/05/13/sql-network-interfaces-error-26-error-locating-server-instance-specified.aspx but as I'm new to SqlServer I do not know how to check on the first three items.
I'm getting extremely frustrated, and would just like the login portion of this website to start working before my boot ends up through the computer. Please help, lol, thank you.
View 9 Replies
View Related
Nov 4, 2005
Which format is assumed for connection string for SqlCeConnection?
View 12 Replies
View Related
Feb 27, 2007
Hi, there;
I have a couple of issue that really frustrates me. I asked a similar question before but I haven't resolved it yet.
My application was developed with VS2003, c#,CF1.0,Sp1.
I found that after my application runs for a couple of hours, my SqlCeDataAdapter.Fill() method throw exception "Error Code: 8007000E Message : Not enough storage is available to complete this operation.". I found a couple of threads on the website said that I have to dispose adapter object (including its command objects.) Yes, I did!!!. And I also dispose my SqlCeConnection before it is out of range and recreate it when I need it. See:http://www.tutorials-se.com/sqlserverce/Keeping-SqlCeConnection/
I also introduced hotfix from http://support.microsoft.com/Default.aspx?kbid=827837.
It looks like I tried everything, but I still has this exception.
At the same time, From thread "http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=426640&SiteID=1", Mr. Ilya said "native DLL (e.g. bar code scanner API) " could cause AV (access violation) issue. Yes, my application is running on Symbol 9062B device which use barcode scanner API, sometimes application will have "0xc0000005" exception when it exists (not when it is running)
A serious problem is that the laser randomly crash in the middle of the scanning without any exception. I am quite sure it is not code logic issue. This happens since I introduced two SqlCeConnections which point to two different .sdf files (run at background threads).
My impression is that the memory or stack are corrupted for some reason.
Hopefully I make myself clear.
So my question is:
1. Will Sp3 help this? (Of course I will do some test)
2. How can I know memory or stack are corrupted/How to trace.
Again, thanks Mr.Ilya, you do a great job here, you are really really helpful!
View 3 Replies
View Related
Oct 17, 2006
Hi,
We have a number of databases running on our SQL2000 Servers. The databases use Stored Procedures which we call from our VB.NET apps, developed in-house. We now wish to upgrade our servers to SQL2005.
In the past, when upgrading from VS2002 to 2003 and then 2005, we have developed and executed Test Plans to ensure that the code upgrades properly. Microsoft even supplies FXCop and other tools to help. I now wish to develop and execute a similar Test Plan to ensure that our databases will work as required.
Does Microsoft supply any similar tools or guidelines for testing that databases written for SQL2000 will work as required on SQL2005? I see the Upgrade Wizard to examine the Server but is there a similar tool for testing databases? Are there any guidelines on the tests to include in such a Test Plan?
Thanks
View 3 Replies
View Related
Jan 30, 2008
I've got an application uses a WPF GUI, is built in VS2008 final, targets .Net Framework 3.5, and uses a Sql Ce 3.5 database for local storage. After a specific WPF window is rebound the application hangs. Hitting pause on the debugger reveals the offending method is a call to SqlCeConnection.Dispose(). Via Reflector I can see this method calls SqlCeConnection+ObjectLifeTimeTracker.Close() which in turn calls GC.WaitForPendingFinalizers(). Within WPF there are some objects (specifically TextBox) which need to have their resources freed on the main application thread. The finalizer thread is waiting on the main application thread, which is in turn waiting on the finalizer thread, resulting in a deadlock.
You can see some additional discussion of the topic including our temporary resolution in this thread.
My question is why is there a call to GC.WaitForPendingFinalizers() buried within the SqlCeConnection.Dispose() call tree?
View 7 Replies
View Related
Jul 11, 2006
Hi,
I'm having the problem that my application hangs on SqlCeConnection.Dispose() when I'm closing the app.
public class DatabaseManager : IDisposable
{
private DbConnection connection = null;
// Singleton
private DatabaseManager()
{
this.CreateConnection();
}
~DatabaseManager()
{
this.Dispose();
}
public void Dispose()
{
if (this.connection != null)
{
this.connection.Dispose();
}
}
// ...
}
This only happens when I'm calling Application.Exit(); and Dispose is called through the destructor of the DatabaseManager class. When I'm disposing the connection during normal work the call works as intended. BTW I'm using SQL Server Mobile 3.0.5214.0 on a PPC 2003 AKU2 (Symbol PPT8846 industrial device).
Thanks for support,
Klaus
View 1 Replies
View Related
Feb 19, 2008
Hi Frndz
I am facing a problem with vb.net application which i created to connect with and sqlservermobile edition file (.sdf).
while the connection is declared, its producing the error that "Exception from Hresult : 0x4007000B." and some inner exception error lines.
i imported system.data.sqlceserver and added the references too.
but It is working in my one of the system. i tried the same in some other system,its not working. you frndz have any about this. I think the system is lacking some dll files. any body having an idea about this. pls help me out.
Nahas
View 1 Replies
View Related
Nov 13, 2007
Hi
I am developing a program on Visual Basic 2005 to a pocket pc, I want to make the SQLceconnection but It says that the file doesn´t exists, I use this code:
Dim conn As New SqlCeConnection()
Dim Recordset As SqlCeDataAdapter
Dim SQL As String
Dim ds As New DataSet
conn.ConnectionString = _
"Data Source = '.BDDclimatologicos.sdf';"
conn.Open()
SQL = "select [Provincia] from ZonasClimaticas"
Recordset = New SqlCeDataAdapter(SQL, conn)
Recordset.Fill(ds, "ZonasClimaticas")
lstboxProvincias.DataSource = ds.Tables("ZonasClimaticas").DefaultView
I have Dcilmatologicos.sdf on a folder named BD next to the folder of the executable, I don´t know what happends.
My database has one table "ZonasClimaticas" and a column named "Provincia" on that, my other question is:
Is this the right code to show that column on a listbox?
Thank you very much!
View 4 Replies
View Related
Apr 4, 2007
Hi all,
I am trying to access my SQL Server database through SqlCeConnection:
cecon = new SqlCeConnection("Data Source=D:\D_Drive\csharppract\nddbpda\nddbpda\nddbpdadatabase.sdf");
cecon.Open();
I am getting the following error:
System.Data.SqlServerCe.SqlCeException was unhandled
Message="The path is not valid. Check the directory for the database. [ Path = D:\D_Drive\csharppract\nddbpda\nddbpda\nddbpdadatabase.sdf ]"
HResult=-2147467259
NativeError=25009
Source="SQL Server 2005 Mobile Edition ADO.NET Data Provider"
StackTrace:
at System.Data.SqlServerCe.SqlCeConnection.ProcessResults()
at System.Data.SqlServerCe.SqlCeConnection.Open()
at System.Data.SqlServerCe.SqlCeConnection.Open()
at nddbpda.frmCeMain.frmCeMain_Load()
at System.Windows.Forms.Form.OnLoad()
at System.Windows.Forms.Form._SetVisibleNotify()
at System.Windows.Forms.Control.set_Visible()
at System.Windows.Forms.Application.Run()
at nddbpda.Program.Main()
When I tried to get the path from which the database file is being accepted, I got a different path:
string path;
path = System.IO.Path.GetDirectoryName(
System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
MessageBox.Show(path);
This code gives me this path:
Program Filesddbpda
Then I changed the path in my connection string to this:
cecon = new SqlCeConnection("Data Source=\Program Files\nddbpda\nddbpdadatabase.sdf");
cecon.Open();
When I ran my application it worked (virtually), but the database is not getting updated (for obvious reasons).
What should I do now to correct this?
Thanks in advance.
Saswata.
View 3 Replies
View Related
Apr 4, 2007
Hi all,
I am trying to access my SQL Server database through SqlCeConnection:
cecon = new SqlCeConnection("Data Source=D:\D_Drive\csharppract\nddbpda\nddbpda\nddbpdadatabase.sdf");
cecon.Open();
I am getting the following error:
System.Data.SqlServerCe.SqlCeException was unhandled
Message="The path is not valid. Check the directory for the database. [ Path = D:\D_Drive\csharppract\nddbpda\nddbpda\nddbpdadatabase.sdf ]"
HResult=-2147467259
NativeError=25009
Source="SQL Server 2005 Mobile Edition ADO.NET Data Provider"
StackTrace:
at System.Data.SqlServerCe.SqlCeConnection.ProcessResults()
at System.Data.SqlServerCe.SqlCeConnection.Open()
at System.Data.SqlServerCe.SqlCeConnection.Open()
at nddbpda.frmCeMain.frmCeMain_Load()
at System.Windows.Forms.Form.OnLoad()
at System.Windows.Forms.Form._SetVisibleNotify()
at System.Windows.Forms.Control.set_Visible()
at System.Windows.Forms.Application.Run()
at nddbpda.Program.Main()
When I tried to get the path from which the database file is being accepted, I got a different path:
string path;
path = System.IO.Path.GetDirectoryName(
System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
MessageBox.Show(path);
This code gives me this path:
Program Filesddbpda
Then I changed the path in my connection string to this:
cecon = new SqlCeConnection("Data Source=\Program Files\nddbpda\nddbpdadatabase.sdf");
cecon.Open();
When I ran my application it worked (virtually), but the database is not getting updated (for obvious reasons).
What should I do now to correct this?
Thanks in advance.
Saswata.
View 5 Replies
View Related
Nov 24, 2006
Hi guys, can I know the steps on creating a database snapshot on a mirror database? Thx for the assistance. :)
Best Regards,
Hans
View 1 Replies
View Related
Sep 7, 2007
I get the below error only when my IDE open. It connects well when it is found closed.
[SqlException (0x80131904): Cannot open user default database. Login failed.Login failed for user 'JPASPNET'.]
I could solve this by giving the logged in windows user to impersonate under IIS window > WEBSITE > ASP.NET tab > EDIT CONFIG > APPLICATION tab
But I wish someone could give me the proper solution.
I almost tried all from giving ASPNET user as a administrator to configuring the same in Express management tool.
Environment: XP pro, VWD and SQL Express
View 3 Replies
View Related
Jun 7, 2006
Hi there,
I got an approach like that:
1) Read something from DB - check the value, if true stop if false go on2) Read the second Value (another SQL Statement) - check the value etc.
Now I could open the connection at 1) and if I have to go to 2) I leave the connection open and use the same connection at 2). Is it ok to do that?
The other scenario would be opening a connection at 1), immediately close it after I read the value and open a new connection at 2).
Thanks for the input!
View 4 Replies
View Related
Nov 3, 2014
Post installation of SQL Server 2014 Express edition, I am able to connect to the Database Instance.
But while opening a new query window in SSMS or opening a table getting the error:
Package 'RadLangSvc.Package, RadLangSvc, Version 12.0.0.0, Culture=Neutral, Public Token=89845dcd8080cc91' failed to load
Object reference not set to an instance of an object. (mscorlib)..Have already tried installing the componentsDACProjectSystemSetup_enu.msi, TSql LanguageService_enu.msi, DACFramework_enu.msi from path VS 2010 WCU DAC.
View 5 Replies
View Related
Jun 26, 2006
Hi,
I am using SSRS Microsoft SQL Server Reporting Services Designers
Version 9.00.1399.00. I want to open linked report in new window.
I tried whats mentioned in http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=240172&SiteID=1 but i get an error on Window.Open method.
How do I solve the problem?
Thanks
View 1 Replies
View Related
Jul 20, 2005
Just a quick question about connection management. My application willnever need more than 1 or 2 connections about at any given time. Also, I donot expect many users to be connected at any given time. For efficiency, Iwould like to keep connections alive throughout the lifetime of the objectsrequiring them, rather than opening a new connection, executing code andthen closing it again. What is the most efficient way of doing this?Should I perform the open/close or just one open when I create the objectand a close when I dispose of it?
View 1 Replies
View Related
Jun 9, 2008
hi alli cant open sql server.i try window authentication and sql server authentication butit doesnt open. how can i do ? Thanks
View 4 Replies
View Related
Jun 19, 2007
Hello Im trying to open an example RDL file I downloaded..the file type is XML ..when i open it up it contains all XML
How can i view this in GUI format from Visual Studio? It is an example off how to use default 'select all' in multivalued parameters so i assume I can see it working as a project ? Not sure how to use this XML file?
anybody please help
thanks
View 2 Replies
View Related
Dec 31, 2007
hi , can any one pls help
what are all the minimum required permissions to do ddl , dml statements on database.
we have so many logins .which and every having sysadmin, i removed sysadmin permission and assign db_owner permission to 7 users and only 3 users having error
cannot open database ' db_nam' requested by login. the login failed. Login failed for user 'ohmvarun1'
pls help me on this isssue some urgent
regards
View 6 Replies
View Related
May 19, 2006
I have to insert one table by using the concept OPENXML
But i want to insert a table lot of fields i require, in the open XML few fields fields are there , so i want to selet some fields from other table
can u guide me for this scenario to INSERT some fields from one table and some in OPENXML as a single insert statement
Awaiting for Reply PLease
Thanx
View 1 Replies
View Related
Sep 11, 2006
Hi all, now, i create a job to open a page on timely basis. The job's Vb script is like that:Dim WshShellSet WshShell =CreateObject("WScript.Shell")WshShell.Run ("http://www.google.com")Set WsShell = Nothing when i run that job, i got that error:The job succeeded. The Job was invoked by User hostusername. The last step to run was step 1 (Step 1). how can i solve it? i still don't know whether that script will open a webpage or not
View 6 Replies
View Related
Oct 24, 2007
Hi,
I have couple of .DBF files that i need to open which software should i use to open them.... can i open it with Sqlserver
Regards
Karen
View 9 Replies
View Related