Ciao a tutti,
ho un problema piuttosto particolare. La mia applicazione si connette con successo al mio database MySQL sul server. Mi è venuta però in mente una nuova funzione che potrei implementare: vorrei infatti controllare se esiste il database e nel caso non esista crearlo tramit e script SQL.
Io ho scritto questo codice
ma mi genera un errore dicendomi che c'è un errore nella query. Dove sbaglio?codice:Dim creaDB As String = "CREATE DATABASE IF NOT EXIST " & frmDatabase.txtDatabase.Text apri() Dim myAdapter As New MySql.Data.MySqlClient.MySqlDataAdapter Dim myCommand As New MySql.Data.MySqlClient.MySqlCommand() myCommand.Connection = conn myCommand.CommandText = creaDB myAdapter.SelectCommand = myCommand Dim myData As MySql.Data.MySqlClient.MySqlDataReader myData = myCommand.ExecuteReader() If myData.HasRows = 0 Then MsgBox("Query eseguita correttamente") Else MsgBox("Query eseguita correttamente") End If chiudi()