酷!學園
2010-09-09 22:54 *
歡迎光臨, 訪客. 請先 登入註冊一個帳號.
您忘了 啟用您的帳號嗎?

請輸入帳號, 密碼以及預計登入時間
新聞:
 
   首頁 | Study-Area | 鳥園 | 鳥哥的Linux私房菜   說明 搜尋 日曆 登入 註冊  
頁: [1]
  列印  
作者 主題: [關於連結資料庫]於Linux上跑asp.net,結果出現…內詳,help me thx~  (閱讀 594 次)
0 會員 以及 1 訪客 正在閱讀本篇主題.
sugsay
可愛的小學生
*
文章: 15


檢視個人資料
« 於: 2008-05-15 16:15 »

 啥
因於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

請問有高手大大知道怎麼解嗎,麻煩了~


已記錄
elleryq
鑽研的研究生
*****
會員性別: 男
文章: 834



檢視個人資料 個人網站
« 回覆文章 #1 於: 2008-05-16 20:37 »

你還在除錯,所以先依照指示
打開 web.config
把 <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
改成 <customErrors mode="Off"/>

才能看到真正的錯誤訊息。
已記錄

lan your work, then work your plan.
我的首頁:http://blog.roodo.com/thinkingmore/
351899by http://counter.li.org
頁: [1]
  列印  
 
前往:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
本頁花了 0.061 秒,以及 15 次的資料庫查詢。