Hello, how come when I run my program, I get an error, I'll high light the error, this is my code
Code:Imports MySql.Data.MySqlClient Imports System.Data Public Class Form2 Private myConnString As String Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim conn As MySqlConnection Dim myData As New DataTable Dim myAdapter As New MySqlDataAdapter Dim myCommand As New MySqlCommand Dim SQL As String conn = New MySqlConnection conn.ConnectionString = "server=" & Form1.TextBox1.Text & ";" _ & "user id=" & Form1.TextBox2.Text & ";" _ & "password=" & Form1.TextBox3.Text & ";" _ & "database=" & Form1.TextBox4.Text & ";" Try conn.Open() Me.Label1.Text = "Connected To: " & Form1.TextBox4.Text myCommand.Connection = conn myCommand.CommandText = SQL myAdapter.SelectCommand = myCommand myAdapter.Fill(myData) < ---------- Gives me an error here " The CommandText property has not been properly initialized. " DataGridView1.DataSource = myData Catch myerror As MySqlException Me.Label1.Text = "Connection to, " & Form1.TextBox4.Text & " has been lost." End Try End Sub End Class




Reply With Quote