Showing posts with label sdf. Show all posts
Showing posts with label sdf. Show all posts

Friday, March 30, 2012

how to create sdf file in c#

hi ,

i just want to create a sdf file using Sql server 2005 CE. I am very new to CE.

can anybody tell me how to create that file?

thanx in advance

Look into SqlCeEngine class.

|||San,

I have a whole series on my blog on how to use SSCE.
http://arcanecode.wordpress.com/arcane-lessons/

Lesson 2 talks about how to create the sdf, lesson 3 the table, and so on.

Hope it helps,

Arcane
|||

this is in vb.net just convert it

to C#

Imports System.Data.SqlServerCe

Public Class Form3

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click


Dim repl As New SqlCeReplication()

repl.InternetUrl = "http://ServerName/snapshot/sqlcesa30.dll"
repl.InternetLogin = "<...>"
repl.InternetPassword = "<...>"
repl.Publisher = "ServerName"
repl.PublisherDatabase = "Merchandising_Dev"
repl.PublisherSecurityMode = SecurityType.DBAuthentication
repl.Publication = "DataPublication"
repl.Subscriber = "Sub1"
repl.HostName = "1" ' This is a prameter for filter the puplication'
repl.PublisherPassword = "password"
repl.PublisherLogin = "Sub1"

repl.SubscriberConnectionString = "Data Source=""\program files\aa.sdf"";Max Database Size=128;Default Lock Escalation =100;"
Try
repl.AddSubscription(AddOption.CreateDatabase)
repl.Synchronize()

Catch err As SqlCeException
MessageBox.Show(err.ToString)
End Try

End Sub
End Class

how to create sdf file in c#

hi ,

i just want to create a sdf file using Sql server 2005 CE. I am very new to CE.

can anybody tell me how to create that file?

thanx in advance

Look into SqlCeEngine class.|||San,

I have a whole series on my blog on how to use SSCE.
http://arcanecode.wordpress.com/arcane-lessons/

Lesson 2 talks about how to create the sdf, lesson 3 the table, and so on.

Hope it helps,

Arcane
|||

this is in vb.net just convert it

to C#

Imports System.Data.SqlServerCe

Public Class Form3

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click


Dim repl As New SqlCeReplication()

repl.InternetUrl = "http://ServerName/snapshot/sqlcesa30.dll"
repl.InternetLogin = "<...>"
repl.InternetPassword = "<...>"
repl.Publisher = "ServerName"
repl.PublisherDatabase = "Merchandising_Dev"
repl.PublisherSecurityMode = SecurityType.DBAuthentication
repl.Publication = "DataPublication"
repl.Subscriber = "Sub1"
repl.HostName = "1" ' This is a prameter for filter the puplication'
repl.PublisherPassword = "password"
repl.PublisherLogin = "Sub1"

repl.SubscriberConnectionString = "Data Source=""\program files\aa.sdf"";Max Database Size=128;Default Lock Escalation =100;"
Try
repl.AddSubscription(AddOption.CreateDatabase)
repl.Synchronize()

Catch err As SqlCeException
MessageBox.Show(err.ToString)
End Try

End Sub
End Class

Monday, March 19, 2012

How to create a sdf file using SQL 2005 Management Studio

Does SQL Server Compact Edition support Linked Server? I have 2 SDF files and I want to copy data from one to the other? I thought Linked Server is the easier to go.

No, linked server is not supported by SQL CE. You can try to use the SSMS query analyzer and copy/paste, depending on the amount of data to be copied, or you can code your own "import/export". There are also third party tools available, like http://www.primeworks-mobile.com/Products/DataPortCommand.html

|||

Hi,

As per my present project requirement, I am planning to create a smart client application.

For this I need part of server central DB to be on mobile device. Since we have central DB on SQL 2005, I planned to create a sdf file using Mangt studio and refer the same in VS 2005. Is there a way I can take a set of tables and create a sdf using SQL Server 2005? I tried to right-click the existing DB I have created in SQL 2005 (using management studio) and export, but invain, I couldnt get a right Data Provider for this export.

Any pointers in this regard will be really helpful.

Regards,

DSB

Monday, March 12, 2012

How to create a linked Server using SQL Server Management Studio?

Does SQL Server Compact Edition support Linked Server? I have 2 SDF files and I want to copy data from one to the other? I thought Linked Server is the easier to go.

No, linked server is not supported by SQL CE. You can try to use the SSMS query analyzer and copy/paste, depending on the amount of data to be copied, or you can code your own "import/export". There are also third party tools available, like http://www.primeworks-mobile.com/Products/DataPortCommand.html

|||

Hi,

As per my present project requirement, I am planning to create a smart client application.

For this I need part of server central DB to be on mobile device. Since we have central DB on SQL 2005, I planned to create a sdf file using Mangt studio and refer the same in VS 2005. Is there a way I can take a set of tables and create a sdf using SQL Server 2005? I tried to right-click the existing DB I have created in SQL 2005 (using management studio) and export, but invain, I couldnt get a right Data Provider for this export.

Any pointers in this regard will be really helpful.

Regards,

DSB

Wednesday, March 7, 2012

how to create .sdf files ?

For a SS05 database , how to create the corresponding SQL Everywhere .sdf
files ?John A Grandy wrote:
> For a SS05 database , how to create the corresponding SQL Everywhere .sdf
> files ?
In Management Studio click on Connect in the Object Browser. Choose SQL
Server Mobile and specify the file name. I guess that hasn't changed
for Everywhere Edition but I haven't tried it myself.
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--|||I believe you're referring to how to open an existing SQL Mobile / SQL
Everywhere db ( .sdf file )
I need to create a SQL Everywhere .sdf file for an existing SS05 db.
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:1161719444.886080.104470@.i42g2000cwa.googlegroups.com...
> John A Grandy wrote:
> In Management Studio click on Connect in the Object Browser. Choose SQL
> Server Mobile and specify the file name. I guess that hasn't changed
> for Everywhere Edition but I haven't tried it myself.
> --
> David Portas, SQL Server MVP
> Whenever possible please post enough code to reproduce your problem.
> Including CREATE TABLE and INSERT statements usually helps.
> State what version of SQL Server you are using and specify the content
> of any error messages.
> SQL Server Books Online:
> http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
> --
>|||"John A Grandy" <johnagrandy-at-yahoo-dot-com> wrote in message
news:%237bAeN79GHA.3392@.TK2MSFTNGP05.phx.gbl...
>I believe you're referring to how to open an existing SQL Mobile / SQL
>Everywhere db ( .sdf file )
> I need to create a SQL Everywhere .sdf file for an existing SS05 db.
>
Apologies. If you click the database file combo box you'll see the option to
create a new database.
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--

how to create .sdf files ?

For a SS05 database , how to create the corresponding SQL Everywhere .sdf
files ?
John A Grandy wrote:
> For a SS05 database , how to create the corresponding SQL Everywhere .sdf
> files ?
In Management Studio click on Connect in the Object Browser. Choose SQL
Server Mobile and specify the file name. I guess that hasn't changed
for Everywhere Edition but I haven't tried it myself.
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx

how to create .sdf files ?

For a SS05 database , how to create the corresponding SQL Everywhere .sdf
files ?John A Grandy wrote:
> For a SS05 database , how to create the corresponding SQL Everywhere .sdf
> files ?
In Management Studio click on Connect in the Object Browser. Choose SQL
Server Mobile and specify the file name. I guess that hasn't changed
for Everywhere Edition but I haven't tried it myself.
--
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--|||I believe you're referring to how to open an existing SQL Mobile / SQL
Everywhere db ( .sdf file )
I need to create a SQL Everywhere .sdf file for an existing SS05 db.
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:1161719444.886080.104470@.i42g2000cwa.googlegroups.com...
> John A Grandy wrote:
>> For a SS05 database , how to create the corresponding SQL Everywhere .sdf
>> files ?
> In Management Studio click on Connect in the Object Browser. Choose SQL
> Server Mobile and specify the file name. I guess that hasn't changed
> for Everywhere Edition but I haven't tried it myself.
> --
> David Portas, SQL Server MVP
> Whenever possible please post enough code to reproduce your problem.
> Including CREATE TABLE and INSERT statements usually helps.
> State what version of SQL Server you are using and specify the content
> of any error messages.
> SQL Server Books Online:
> http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
> --
>|||"John A Grandy" <johnagrandy-at-yahoo-dot-com> wrote in message
news:%237bAeN79GHA.3392@.TK2MSFTNGP05.phx.gbl...
>I believe you're referring to how to open an existing SQL Mobile / SQL
>Everywhere db ( .sdf file )
> I need to create a SQL Everywhere .sdf file for an existing SS05 db.
>
Apologies. If you click the database file combo box you'll see the option to
create a new database.
--
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--