$ConnStr="Server=$Server; port=$Port;uid=$User;pwd=$Pass;database=$Database;Pooling=$Pooling; charset=$CharSet"
$Conn=New-Object MySql.Data.MySqlClient.MySqlConnection($ConnStr)
$Conn.Open
$Sql="SELECT* FROM table WHERE cid=$cid;"
$Cmd = New-Object MySql.Data.MySqlClient.MySqlCommand($Sql,$Conn)
$DataAdapter=New-Object MySql.Data.MySqlClient.MySqlDataAdapter ($Cmd)
$DataSet = New-Object System.Data.DataSet
$DataCnt=$DataAdapter.Fill($DataSet, "table") | Out-Null
Last
$DataCnt=$DataAdapter.Fill($DataSet, "table")|Out-Null
The following error occurs on the line:
ERROR: An exception occurred while calling "Fill" with "2" arguments: "Unable to connect to any of the specified MySQL hosts."
Type DataTable not found.Make sure that the assembly containing this type is loaded.
Exception while invoking "Fill" with "2" arguments: "Unable to connect to any of the specified MySQL hosts."
Exception while invoking "Fill" with "2" arguments: "Unable to connect to any of the specified MySQL hosts."
An exception occurred while calling "Fill" with "1" arguments: "Unable to connect to any of the specified MySQL hosts."
Dataset type not found.Make sure that the assembly containing this type is loaded.
Type DataTable not found.Make sure that the assembly containing this type is loaded.
Exception while invoking "Fill" with "2" arguments: "Unable to connect to any of the specified MySQL hosts."
Exception while invoking "Fill" with "2" arguments: "Unable to connect to any of the specified MySQL hosts."
Exception while invoking "Fill" with "2" arguments: "Unable to connect to any of the specified MySQL hosts."
Exception while calling "Open" with "0" arguments: "Unable to connect to any of the specified MySQL hosts."
Exception while calling "Open" with "0" arguments: "Unable to connect to any of the specified MySQL hosts."
Exception while calling "Open" with "0" arguments: "Unable to connect to any of the specified MySQL hosts." [0]
Is there an error in MySqlConnection.Open
before DataAdapter.Fill
?
Exception while calling "Open" with "0" arguments: "Unable to connect to any of the specified MySQL hosts." [0]
By the way
$Conn.Open
If you write only the method name as shown in , no method calls are made, only delegate
( ポ function pointer) is retrieved, so the code is not expected to be as intended.
© 2024 OneMinuteCode. All rights reserved.