WIP: EDM Designer, create table
This commit is contained in:
@@ -16,7 +16,7 @@ Public Class FrmNewTable
|
||||
_logger = _logFactory.GetCurrentClassLogger()
|
||||
End Sub
|
||||
|
||||
Private Sub FrmNewTable_Load(sender As Object, e As KeyEventArgs) Handles Me.Load
|
||||
Private Sub FrmNewTable_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
Try
|
||||
_db = New Firebird(_logFactory, My.Settings.fbDatasource, My.Settings.fbDatabaseLocation, My.Settings.fbUser, My.Settings.fbPassword)
|
||||
Catch ex As Exception
|
||||
@@ -26,6 +26,26 @@ Public Class FrmNewTable
|
||||
End Sub
|
||||
|
||||
Private Sub btnOK_Click(sender As Object, e As EventArgs) Handles btnOK.Click
|
||||
Dim oTableName As String = txtTablename.Text
|
||||
|
||||
If oTableName.Trim() = String.Empty Then
|
||||
MsgBox("Table name cannot be empty!", MsgBoxStyle.Exclamation)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim oExistingTableId = _db.GetScalarValue($"SELECT GUID FROM TBEDM_TABLE WHERE DESCRIPTION = '{oTableName}'")
|
||||
|
||||
If oExistingTableId IsNot Nothing Then
|
||||
MsgBox("Table already exists!", MsgBoxStyle.Exclamation)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim oResult = _db.GetScalarValue($"SELECT FNCREATE_TABLE('{oTableName}','{Environment.UserName}') FROM rdb$database;")
|
||||
|
||||
If oResult >= 0 Then
|
||||
Close()
|
||||
Else
|
||||
MsgBox("An error occurred while creating the table. Check the log", MsgBoxStyle.Critical)
|
||||
End If
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user