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
No comments:
Post a Comment