Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8639351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:58:45+00:00 2026-06-12T10:58:45+00:00

VB.NET, Winforms Application with MySQL. In my app I have added the ability to

  • 0

VB.NET, Winforms Application with MySQL. In my app I have added the ability to Update it through the use of mail attachments because of limitations of Funds and Connection reliability. Everything works good. Well in the Apps form load even I have it check for the existence of a file. If it exists there are changes to be made to the database. So the below Sub is called and the contents of that file are read in to an arrayList… I am getting the “CommandText property has not been properly Initialized” error when the app starts from outside VS.

 Private Sub sqlUpdate(ByVal sqlScriptName As String)
    Dim D As Boolean = BackupDatabase("C:\xxxxxxxx\temp.sql")

    Dim objReader As New StreamReader(sqlScriptName)
    Dim sLine As String = ""
    Dim arrText As New ArrayList()
    Do
        sLine = objReader.ReadLine()
        If Not sLine Is Nothing Then
            arrText.Add(sLine)
        End If
    Loop Until sLine Is Nothing
    objReader.Close()

    For Each sLine In arrText
        Dim conn As New MySqlConnection
        Dim myCommand As New MySqlCommand
        Dim connString As String = My.Settings.storageConnectionString
        conn.ConnectionString = connString
        myCommand.Connection = conn
        myCommand.CommandText = String.Empty
        Try
            myCommand.CommandText = sLine
            conn.Open()
            myCommand.ExecuteNonQuery()
        Catch myerror As MySqlException
            'MsgBox("There was an error updating the database: " & myerror.Message + vbNewLine + "PLEASE CONTACT THE DEVELOPER IMMEDIATELY")
        End Try

    Next

    Return

End Sub

Not sure where the Problem is comming from and have followed the execution all the way down… The sList contains Valid MYSQL commands that look like this:

  ALTER TABLE `storage`.`property_info` ADD COLUMN `pfam_pName` CHAR(200) NULL  AFTER `pfam_Phone` ;

Any ideas that could send me in the right direction with this???

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T10:58:47+00:00Added an answer on June 12, 2026 at 10:58 am

    I found no error on your code but I suspect that there are empty lines in your script thus allowing it to pass empty string on your command text. Please do modify the reading of file into this,

    Do
        sLine = objReader.ReadLine()
        If (Not sLine Is Nothing) Then
            If sLine.Trim().Length <> 0 Then      ' this will not add empty line '
               arrText.Add(sLine)
            End If
        End If
    Loop Until sLine Is Nothing
    

    or

    For Each sLine In arrText 
        If sLine.Trim().Length = 0 Then Continue For   ' skips for empty line '
    
        Try 
            myCommand.CommandText = sLine 
            myCommand.ExecuteNonQuery() 
        Catch myerror As MySqlException 
            MsgBox("There was an error updating the database: " & _
                    myerror.Message & vbNewLine & _
                    "PLEASE CONTACT THE DEVELOPER IMMEDIATELY") 
        End Try 
    Next
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say you have multiple MVP triads in your application (WinForms .NET 2.0 app) and
I have a winforms application connected to Mysql using the .Net driver. I written
I have a vb.net Winforms application. I also have a compiled help file (chm)
I have a .NET WinForms application with an animated GIF in a PictureBox .
I have a .net WinForms 2.0 application that has an image library of about
I have a WinForms application written in C# for .NET 3.5 that needs to
Consider we have .NET Winforms application or Console Application. Can anyone tell me what
I have a small .NET WinForms application, and couple of linux servers, DEV and
I have a .NET WinForms application that I've converted into a COM dll using
I am new to Microsoft Dynamic CRM. I have a .NET Winforms application which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.