Any commands for creating database using oracle command? as well as creating tables?
I have this in creating table but did not work. Having invalid table name error.
Imports Oracle.DataAccess.Client
Imports Oracle.DataAccess.Types
Public Class dump
Dim conn As New OracleConnection
Private cmd As OracleCommand
Private da As OracleDataAdapter
Private cb As OracleCommandBuilder
Private ds As DataSet
Dim lubid As String = "User Id= PETHOTEL" & ";Password= 911" & ";Data Source = xe"
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
conn.ConnectionString = lubid
conn.Open()
Dim sql = "CREATE TABLE 'TRANS'" _
& "( 'TRANS_ID' NUMBER NOT NULL ENABLE," _
& " 'CAMOUNT' NUMBER NOT NULL ENABLE," _
& "'COST' NUMBER NOT NULL ENABLE, " _
& " 'CHANGE' NUMBER NOT NULL ENABLE," _
& " 'CUSTOM_ID' NUMBER NOT NULL ENABLE, " _
& "'EMP_ID' NUMBER, " _
& "'PET_ID' NUMBER, " _
& " 'DATESTART' DATE, " _
& "'DATEEND' DATE," _
& " 'SERVICES' VARCHAR2(100), " _
& " 'STATUS' NUMBER, " _
& "'ROOMCOST' NUMBER, " _
& " 'DATETODAY' DATE, " _
& " Constraint() 'TRANS_PK' PRIMARY KEY ('TRANS_ID') DISABLE" _
& ") ;ALTER TABLE 'TRANS' ADD CONSTRAINT 'TRANS_FK' FOREIGN KEY ('CUSTOM_ID')" _
& "REFERENCES() 'CUSTOMER' ('CUSTOM_ID') DISABLE;"
cmd = New OracleCommand(sql, conn)
cmd.ExecuteNonQuery()
MessageBox.Show("Record updated", "Autobots Ex", MessageBoxButtons.OK, MessageBoxIcon.Information)
conn.Close()
Catch ex As Exception
MsgBox(ex.Message)
conn.Close()
End Try
End Sub
End Class