Dim con As New SqlCeConnection
con.ConnectionString = "Data Source='|DataDirectory|\Database.sdf';Password='1997526alex'"
If con.State = ConnectionState.Closed Then
con.Open()
End If
Try
Dim cmd As SqlCeCommand = con.CreateCommand()
Dim sql As String = "create table CoolPeople (" _
+ "LastName nvarchar (40) not null, " _
+ "FirstName nvarchar (40), " _
+ "URL nvarchar (256) )"
cmd = New SqlCeCommand(sql, con)
cmd.ExecuteNonQuery()
MsgBox("Table created.")
Catch sqlexception As SqlCeException
MessageBox.Show(sqlexception.Message, "Oh Crap." _
, MessageBoxButtons.OK, MessageBoxIcon.Error)
Catch ex As Exception
MessageBox.Show(ex.Message, "Oh Crap." _
, MessageBoxButtons.OK, MessageBoxIcon.Error)
Finally
con.Close()
End Try
When I click it says "Table created" but when i verify nothing. If I repress it sayd was created. Why is not created?

New Topic/Question
Reply



MultiQuote



|