鐵之狂傲

 取回密碼
 註冊
搜尋

切換到指定樓層
1#
這是我寫的..可不可以麻煩懂資料庫的大大看一下出了什麻問題
執行的時後出現找不到可安裝的 ISAM 找不到決解的方法 QQ
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<html>
<head>
</head>
<body>
<form runat="server">
</form>
<table>
<tr><td>性名:<asp:textBox id="user1" text="" runat="server" /><br></td></tr>
<tr><td>內容:<asp:textBox id="Message" textmode="Multiline" columns="30" rows="5" runat="server" /><br></td></tr>
<tr><td><asp:button id="bbb" text="送出" runat="server" /></tr></td>
<tr><td><asp:Label id="talkout" runat="server" /></tr></td>
</table>
</body>
</html>
<Script Language="VB" Runat="Server">
Dim objCon As OleDbConnection
Dim objCmd As OleDbCommand
Dim StrDbCon ="Provider=Microsoft.Jet.OLEDB.4.0;Data Cource=" & Server.Mappath("talk.mdb")
Sub Page_Load(sender As Object, e As EventArgs)
If isPostBack Then
addGuestBook()
End If
ViewGuestBook()
End Sub
Sub addGuestBook()
Dim strUser , strMessage , strSQL as string
strUser = user1.text
strMessage = Message.text
strSQL = "INSERT INTO Talk(Ttim,UserName,Message) "
strSQL &= "VALUES('" & DateTime.Now.Tostring() & "','"
strSQL &= strUser & "','"
strSQL &= Replace(strMessage,"'","''") & "')"
objCon = New OleDbConnection(strDbCon)
objCon.open()
objCmd = New OleDbCommand(strSQL , objCon)
objCmd.ExecuteNonQuery()
objCon.Close()
End Sub
Sub viewGuestBook()
Dim StrSQL , output As string
objCon = New OleDbConnection(strDbCon)
objCon.Open()
strSQL="SELECT * FROM 留言版 ORDER BY Ttime DESC"
objCmd = New OleDbCommand(strSQL, objCon)
Dim objDataReader As OleDbDataReader
objDataReader = objCmd.ExecuteReader()
While objDataReader.Read()
output &= "<b>日期</b><p>" & objDataReader.Item("Ttime") & "<br>"
output &= objDataReader.Item("UserName") & "說:" &"<br>"
output &= objDataReader.Item("Message") & "</p><hr>"
End While
objDataReader.Close()
objCon.Close()
talkout.text = output
End Sub
</Script>

talk.rar

20 Bytes, 下載次數: 189

 
轉播0 分享0 收藏0

回覆 使用道具 檢舉

你需要登入後才可以回覆 登入 | 註冊

存檔|手機版|聯絡我們|新聞提供|鐵之狂傲

GMT+8, 24-12-26 15:36 , Processed in 0.019751 second(s), 18 queries , Gzip On.

回頂部