導航:首頁 > 萬維百科 > 設計網頁如何連接資料庫

設計網頁如何連接資料庫

發布時間:2021-01-19 12:28:07

1、網頁設計中用戶登陸設計時怎樣與資料庫連接?

這樣:
一個資料庫,表名為login,假設為Access資料庫,內有name,pw兩個欄位。
一個登陸頁面:login.asp
一個檢驗頁面:check.asp

login.asp部分代碼(省略html代碼,只列部分關鍵代碼,不會的可發送消息給我):
<form method="post" action="info.asp">
<input type="type" name="name">
<input type="password" name="pw">
</form>

check.asp部分代碼:
<%
dim name,pw
name=trim(request("name"))
pw=trim(request("pw"))
if name="" or pw="" then
response.Write "<script language='javascript'>window.confirm('對不起,用戶名或密碼均不能為空!');</script>"
response.Write "<script language='javascript'>parent.window.history.go(-1);</script>"
else
set rs=server.CreateObject("adodb.recordset")
sql="select * from info where name='"&name&"' and pw='"&pw&"'"
rs.open sql,conn,1,1
if rs.recordcount=0 then
response.Write "<script language='javascript'>window.confirm('對不起,用戶名或密碼錯誤,請重新登陸!');</script>"
response.Write "<script language='javascript'>parent.window.history.go(-1);</script>"
else
response.Write "<script language='javascript'>alert('登陸成功!');</script>"
response.Write "location.href='admin.asp';" ''admin.asp為登陸成功後轉向的頁面
end if
end if
%>

2、Dreamweaver做的網頁怎麼與資料庫相連

要是要使用ACCESS資料庫的話,就加行代碼就可以了
不好意思,我只知道ASP的資料庫連接,你也沒專說明到底是什屬么程序語言,HTM或者HTML為後綴的網頁是不能連接資料庫的哦
<%
dim conn
set conn=server.CreateObject("ADODB.Connection")
conn.open "provider=Microsoft.Jet.OLEDB.4.0;data source = " & Server.MapPath("data.mdb")
%>
data.mdb為資料庫文件名,相對於本文件的路徑。
這種連接方式是直連,不需要ODBC。
就可以了。

3、網頁製作時連接資料庫是怎麼寫的

曾經我跟你一樣 跟著視頻做的連接資料庫 後來問了客服才知道不能用 不支持 沒辦法 只能又學慣用代碼 呵呵 現在想想 其實也挺簡單的~~就這么幾句。。。 set conn=Server.CreateObject("ADODB.Connection") conn.Open "driver=Driver do Microsoft Access (*.mdb);uid=admin;DBQ="&Server.MapPath("db1.mdb") set rs=server.CreateObject("adodb.recordset") Sql="select * from [user] " rs.Open Sql,conn,1,3 ... rs.close set rs=nothing

滿意請採納

4、製作網頁的登陸登陸界面怎樣與資料庫里的內容連接全過程

你是使用的JSP嗎? 如果你是使用JSP的話,資料庫連接的步驟如下:
1.把JDBC驅動類裝載入Java虛擬回機中:
Class.forName("JDBC驅動類名答稱");

2.載入驅動,並與資料庫建立連接:
Connection conn=DriverManager.getConnection(資料庫連接字元串,資料庫用戶,資料庫密碼)

3.發送SQL語句:
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery("SELECT a,b,c FROM TABLE");

4.處理結果 :
while(rs.nest()){
int x=rs.getint("a");
}

這就是連接資料庫,希望我的回答能讓你滿意

5、網頁設計連接資料庫視頻教學

鏈接資料庫很簡單的、首先要在控制面板裡面添加一個數據源。然後在DW中資料庫-添加-數據源名稱-接下來那些自己看應該就明白了

6、如何製作簡易網頁和鏈接資料庫? (急)

1、安裝伺服器,例如Apache
2、頁面源代碼中連接資料庫,查詢,顯示等等
注意,在你調試時,資料庫和伺服器都必須是在運行狀態。

7、做網頁時,怎樣連接資料庫?

請問您連接什麼資料庫?是什麼形式的網站asp還是asp.net還是jsp還是php啊,連接資料庫的方回法很多最簡答單的就是dreamweaver自帶的連接,設置參數自動生成文件,就可以了,具體的您可以參考:http://www.pconline.com.cn/pce/sj/wz/dreamweaver/0604/790482.html,或者其他的網址,希望能幫助您

8、我要設計一個網站,現在做一個登陸頁面,怎樣使登陸頁面與SQL資料庫相連?

最簡單的
string connString = ConfigurationManager.AppSettings["ConnectionString"]
string username=Request.QueryString["username"]
string sql="select username , password from user where username=username"
SqlConnection conn = new SqlConnection(connString);
SqlDataAdapter adapter = new SqlDataAdapter(sql, conn);
conn.Open();
DataSet ds = new DataSet();
adapter.Fill(ds);
if(ds.table[0].Rows[0]["username"])
{
Response.Write "登錄成功"
}

與設計網頁如何連接資料庫相關的知識