at my project having 2Databases and my server is using SQL Server 2012 Management Studio. And now i would like to connect to one of the database and made a new table in runtime. But i'm having a problem.
but when i check to my location. It exist and with same name..
here is my code :
Private Sub VBcreate()
Dim sqlcon2 As New SqlConnection(vbcon)
MainMenu.lblStatus.Text = "Creating Virtual Book"
sqlstr = ("USE [VIRTUALBOOK] " & _
"GO() " & _
"SET ANSI_NULLS ON" & _
" GO() " & _
"SET QUOTED_IDENTIFIER ON" & _
" GO() " & _
"CREATE TABLE [dbo].[" & tbEmail.Text & "](" & _
"[ID] [ntext] NULL, " & _
"[REMARKS] [NCHAR](6) NULL " & _
") ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]")
Try
sqlcon2.Open()
cmd = New SqlCommand(sqlstr, sqlcon2)
cmd.CommandType = CommandType.Text
cmd.ExecuteNonQuery()
sqlcon2.Close()
MainMenu.lblStatus.Text = "Command Saved to Server"
Catch ex As Exception
MsgBox(ex.Message)
Finally
sqlcon2.Close()
End Try
End Sub