|
||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||
|
Виклик процедури, що зберігається
"execute getalbumbyname 'Operation Mindcrime'") Try "database=albums;server=i-ri3")
End
Try
Нетривіальний приклад роботи з базами даних в VB .NET
(частина 1)
Мал.
11.2. Головна форма додатку
Мал.
11.3. Форма результатів додатку 'frmmain.vb Imports
System.Data.SqlClient Public
Class frmmain Inherits System.Windows.Forms.Form #region "Windows Form Designer generated code " Public Sub New() Mybase.New() 'Виклик необхідний для роботи дизайнера форм Windows Initializecomponent() ' Подальша ініціалізація виконується ' після виклику Initializecomponent() End
Sub ' Форма перевизначає Dispose для очищення списку компонентів. Protected Overloads Overrides Sub
Dispose(Byval disposing As Boolean) If
Disposing Then If Not
(components Is Nothing) Then components. Dispose() End
If End
If Mybase.Dispose(Disposing) End Sub Private Withevents Label1 As System.Windows.Forms.Label Private Withevents Label2 As System.Windows.Forms.Label Private Withevents Label3 As System.Windows.Forms.Label Private Withevents Label4 As System.Windows.Forms.Label Private Withevents btnconnect As System.Windows.Forms.Button Private Withevents txtuid As System.Windows.Forms.TextBox Private Withevents txtpassword As System.Windows.Forms.TextBox Private Withevents txtdatabase As System.Windows.Forms.TextBox Private Withevents txtserver As System.Windows.Forms.TextBox ' Необхідно для роботи дизайнера форм Windows Private components As System.ComponentModel.Container ' УВАГА: наступний фрагмент необхідний для дизайнера форм Windows ' Для його модифікації слід використовувати дизайнер форм. ' Не
змінюйте його в редакторові! <System.Diagnostics.DebuggerStepThrough()> Private
Sub _ Initial izecomponent() Me.Label4 = New System.Windows.Forms.Label () Me.txtPassword = New System.Windows.Forms.TextBox() Me.Label
1 = New System.Windows.Forms.Label () Me.txtServer = New System.Windows.Forms.TextBox() Me.Label2 = New System.Windows.Forms.Label () Me.Labels = New System.Windows.Forms.Label () Me.txtUID - New System.Windows.Forms.TextBox() Me.txtDatabase = New System.Windows.Forms.TextBox() Me.btnConnect = New System.Windows.forms.Button() Me.SuspendLayout() 'Label4 Me.Label4.Location = New System.Drawing.Point(24.176) Me.Label
4.Name = "Label4" Me.Label4.Size = New System.Drawing.Size(82.19) Me.Label4.TabIndex = 0 Me.Label4.Text = "Password:" Me.Label4.TextAlign = System.Drawi
ng.ContentAlignment.MiddleRight 'txtpassword Me.txtPassword.Location = New
System.Drawing.Point(168.168) |
|
||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||