我想從我的ASP page.So用於連接到MySQL數據庫按什麼我的主機服務商告訴我用在服務器是作爲連接字符串「localhost:3309」SocketException:沒有這樣的主機被稱爲
Dim myConnection As MySqlConnection = New MySqlConnection("server=localhost:3309; user id=TID; password=TPWD; database=TDB; pooling=false;")
Dim strSQL As String = "SELECT * from Device_Data"
Dim myDataAdapter As MySqlDataAdapter = New MySqlDataAdapter(strSQL, myConnection)
Dim myDataSet As DataSet = New DataSet()
myDataAdapter.Fill(myDataSet, "Device_Data")
MySQLDataGrid.DataSource = myDataSet
MySQLDataGrid.DataBind()
但是當我運行該頁面我得到這個錯誤
[SocketException (0x2af9): No such host is known]
System.Net.Dns.GetAddrInfo(String name) +6134386
System.Net.Dns.InternalGetHostByName(String hostName, Boolean includeIPv6) +136
System.Net.Dns.GetHostEntry(String hostNameOrAddress) +109
MySql.Data.Common.StreamCreator.GetDnsHostEntry(String hostname) +123
[Exception: Call to GetHostEntry failed after 00:00:02.2499197 while querying for hostname 'localhost:3309': SocketErrorCode=HostNotFound, ErrorCode=11001, NativeErrorCode=11001.]
MySql.Data.Common.StreamCreator.GetDnsHostEntry(String hostname) +405
MySql.Data.Common.StreamCreator.GetStream(UInt32 timeout) +457
MySql.Data.MySqlClient.NativeDriver.Open() +215
[MySqlException (0x80004005): Unable to connect to any of the specified MySQL hosts.]
MySql.Data.MySqlClient.NativeDriver.Open() +283
MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings) +51
MySql.Data.MySqlClient.MySqlConnection.Open() +362
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +123
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +319
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +92
show.form1_Load(Object sender, EventArgs e) in
System.Web.UI.Control.OnLoad(EventArgs e) +91
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Control.LoadRecursive() +146
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207
因此,這是服務器的問題?如果是,那麼他們應該怎麼做才能解決這個問題?當與服務員聯繫時,他們說這是我的編碼問題。他們是對的嗎?
thanks..for澄清事情 – Shijilal 2011-02-11 17:16:56