2017-01-14 8 views
-1

自分のPC(Windows 10)にスタンドアロンのVisual Basicアプリケーションをインストールしました。アプリケーションがリモートサーバー(IPのような192.1xx.x.xxx)を接続している。 アプリケーションを実行するとエラーが発生します。Windows 10でmysqlのデフォルトのlocalhost ipを変更する方法

ユーザー接続に失敗しました。サーバー/データベースがありません。 MySqlホストに接続できません。

私はアプリケーションで使用されているVBScriptsデータベースとMySQLデータベースを持っています。私は、スクリプトを使ってアプリケーションをビルドするためのVBについてよく知らない。誰かが私にそれを再構築するために案内することができますか?

または

どのように私はMySQLのデフォルトIPを変更できますか?それが私の問題を解決するだろうか?

Sub con() 
    If System.Globalization.DateTimeFormatInfo.CurrentInfo.ShortDatePattern <> "dd/MM/yyyy" Then 
     MsgBox("System Date Format is: " & System.Globalization.DateTimeFormatInfo.CurrentInfo.ShortDatePattern & vbCrLf & _ 
       " compartable on British Date Format only.." & vbCrLf & _ 
       "Change Short Date format to : dd/MM/yyyy" & vbCrLf & _ 
       "And Try Again") 
     'System.Globalization.DateTimeFormatInfo.CurrentInfo.ShortDatePattern = "dd/MM/yyyy" 
     End 
    End If 
    Uid = "root" 
    'PWord = "xxxxx" 
    PWord = "xxxxxxxxxxx" 
    'PWord = "server2" 
    datbase = "xxxxx" 
    Myserver = "" 
    'Myserver = "192.xxx.x.xxx" 
    MyserverCRy = "xxxxxx" 
    'ConString = "server=" & Myserver & ";database=" & datbase & ";Uid=" & Uid & ";Pwd=" & PWord & ";MinimumPoolSize=10;maximumpoolsize=150;" 
    ConString = "server=" & Myserver & ";database=" & datbase & ";Uid=" & Uid & ";Pwd=" & PWord & ";Pooling=false;" 

    Try 
     DBcon.ConnectionString = ConString 
     DBcon.Open() 
     DBcomm.Connection = DBcon 
    Catch e As Exception 
     MsgBox("User Connection Fail" & vbCrLf & "Missing Server/Database" & vbCrLf & "Errors occurred during connection" & vbCrLf & e.Message, MsgBoxStyle.Critical, "Connecting Error") 
     'Application.Exit() 
     End 
    End Try 
    Try 
     DBcon1.ConnectionString = ConString 
     DBcon1.Open() 
     DBcomm1.Connection = DBcon1 
    Catch e As Exception 
     MsgBox("User Connection Fail" & vbCrLf & "Missing Server/Database" & vbCrLf & "Errors occurred during connection" & vbCrLf & e.Message, MsgBoxStyle.Critical, "Connecting Error") 
     End 
    End Try 
    Try 
     DBcon2.ConnectionString = ConString 
     DBcon2.Open() 
     DBcomm2.Connection = DBcon2 
    Catch e As Exception 
     MsgBox("User Connection Fail" & vbCrLf & "Missing Server/Database" & vbCrLf & "Errors occurred during connection" & vbCrLf & e.Message, MsgBoxStyle.Critical, "Connecting Error") 
     End 
    End Try 
    Try 
     dbcon_Insert.ConnectionString = ConString 
     dbcon_Insert.Open() 
     dbcomm_Insert.Connection = dbcon_Insert 
    Catch e As Exception 
     MsgBox("User Connection Fail" & vbCrLf & "Missing Server/Database" & vbCrLf & "Errors occurred during connection" & vbCrLf & e.Message, MsgBoxStyle.Critical, "Connecting Error") 
     End 
    End Try 
End Sub 
+1

コードのヘルプ:コードを表示してください。 MySQLサーバ設定の関連部分も表示してください。 –

+0

*「スタンドアロンVisual Basicアプリケーション」*、何を話していますか、VB.Net、VB6コンパイル済み実行ファイル、OfficeアプリケーションのVBA、またはVBScriptで展開できますか?現時点では、使用しているものと、VBScriptが適合する場所が明確ではありません。 – Lankymart

+0

スタンドアローン.iは実行可能ファイルを意味します。 VBと.netが使用されます。ここにいくつかのコードです.. – var

答えて

0
Myserver = "" 
'[...] 
ConString = "server=" & Myserver & ";database=" & datbase & ";Uid=" & Uid & ";Pwd=" & PWord & ";Pooling=false;"

あなたは空の文字列としてMyserver定義ので、あなたがそのエラーを取得している:ここで

はいくつかのコードです。空の文字列を正しいホスト名またはIPアドレスに置き換えます。

関連する問題