A
alexoh84
hi,
i am new to SQL CE. i am trying to create a new database n i doesn't
seem to work. this is my code which i copy from msdn.com for testing
purposes n it dun work as well.
Dim SQLEngine As SqlCeEngine
SQLEngine = New SqlCeEngine("data source=c:\test.sdf")
SQLEngine.CreateDatabase()
sql = "CREATE TABLE ADR_ADDRESS ( "
sql &= "Address_ID INT IDENTITY(1,1) PRIMARY KEY "
sql &= ",Name nvarchar(50) "
sql &= ",Address ntext "
sql &= ",Telephone ntext "
sql &= ",Last_Edited datetime "
sql &= ",IsPrivate_Flag nvarchar(10) "
sql &= ")"
Dim objConn As New SqlCeConnection
objConn.ConnectionString = "data source=c:\test.sdf"
objConn.Open()
Dim objCmd As SqlCeCommand = New SqlCeCommand(sql, objConn)
objCmd.CommandType = Data.CommandType.Text
objCmd.ExecuteNonQuery()
objCmd.Dispose()
it gave me an error when running saying that the path is invalid. i
even try to manually create the database n try to connect to it n it
still came up with the same error. need help figuring out why.. thanks
i am new to SQL CE. i am trying to create a new database n i doesn't
seem to work. this is my code which i copy from msdn.com for testing
purposes n it dun work as well.
Dim SQLEngine As SqlCeEngine
SQLEngine = New SqlCeEngine("data source=c:\test.sdf")
SQLEngine.CreateDatabase()
sql = "CREATE TABLE ADR_ADDRESS ( "
sql &= "Address_ID INT IDENTITY(1,1) PRIMARY KEY "
sql &= ",Name nvarchar(50) "
sql &= ",Address ntext "
sql &= ",Telephone ntext "
sql &= ",Last_Edited datetime "
sql &= ",IsPrivate_Flag nvarchar(10) "
sql &= ")"
Dim objConn As New SqlCeConnection
objConn.ConnectionString = "data source=c:\test.sdf"
objConn.Open()
Dim objCmd As SqlCeCommand = New SqlCeCommand(sql, objConn)
objCmd.CommandType = Data.CommandType.Text
objCmd.ExecuteNonQuery()
objCmd.Dispose()
it gave me an error when running saying that the path is invalid. i
even try to manually create the database n try to connect to it n it
still came up with the same error. need help figuring out why.. thanks