
因於Linux平台上安裝mono,元件如下:
mono-core-1.2.4-2.fc8
mono-data-sqlite-1.2.4-2.fc8
mono-web-1.2.4-2.fc8
mono-nunit-1.2.4-2.fc8
mono-extras-1.2.4-2.fc8
mod_mono-debug-1.9-3.1
mono-data-oracle-1.2.4-2.fc8
mono-locale-extras-1.2.4-2.fc8
apache-mod_mono-debug-1.2.6-2mdv2008.1
mono-data-1.2.4-2.fc8
mono-data-postgresql-1.2.4-2.fc8
mono-devel-1.2.4-2.fc8
mono-basic-1.2.4-0.novell
mono-winforms-1.2.4-2.fc8
mod_mono-1.2.1-1.fc7
mono-data-sybase-1.2.4-2.fc8
mono-data-firebird-1.2.4-2.fc8
mono-jscript-1.2.4-2.fc8
接著於mysql建立DB01資料庫、teacher資料表、欄位ID與NAME、VALUES為 (1,'AMY'), (2,'BOBY'), (3,'CINDY');如下表
ID NAME
1 AMY
2 BOBY
3 CINDY
建立一asp.net檔WebForm1.aspx,語法如下:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim cn As MySqlConnection
Dim cmd As MySqlCommand
Dim da As MySqlDataAdapter
Dim ds As DataSet
cn = New MySqlConnection("Persist Security Info=False;database=DB01;server=localhost;user id=root;Password=")
'cn = New MySqlConnection("Persist Security Info=False;database=test;server=10.10.11.6;user id=root;Password=")
cmd = New MySqlCommand
da = New MySqlDataAdapter
cmd.Connection = cn
cmd.CommandText = "SELECT * FROM teacher"
da.SelectCommand = cmd
ds = New DataSet
cn.Open()
da.Fill(ds)
cn.Close()
Me.DataGrid1.DataSource = ds.Tables(0)
Me.DataGrid1.DataBind()
End Sub
End Class
結果測試網頁上按鈕有出現,按下按鈕出現如下錯誤訊息:
Server Error in '/test' Application
--------------------------------------------------------------------------------
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
--------------------------------------------------------------------------------
02/14/2015 08:20:41
請問有高手大大知道怎麼解嗎,麻煩了~