菜鸟--access连接问题
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %><%@ Import Namespace="System.Data"%>
<%@ Import Namespace="System.Data.OleDb"%>
<script laguage="VB" runat="server">
Dim myConnection As OleDbConnection
Dim myCommand As OleDbCommand
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim dbname As String
dbname = Server.MapPath("bmm.mdb")
myConnection = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=" & dbname)
myConnection.Open()
txtB2.Text = "Connection Open"
End Sub
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2><asp:Label ID="Lbl1" runat="server" Text="姓 名:"></asp:Label>
<asp:TextBox ID="txtB1" runat="server"></asp:TextBox></h2>
<h2><asp:Label ID="Lbl2" runat="server" Text="编 号:"></asp:Label>
<asp:TextBox ID="txtB2" runat="server"></asp:TextBox></h2>
<h2><asp:Label ID="Lbl3" runat="server" Text="出生日期:"></asp:Label>
<asp:TextBox ID="txtB3" runat="server"></asp:TextBox></h2>
<h2><asp:Label ID="Lbl4" runat="server" Text="毕业学校:"></asp:Label>
<asp:TextBox ID="txtB4" runat="server"></asp:TextBox></h2>
<h2> <asp:Button ID="提交信息" runat="server" Text="Button" /></h2>
</div>
</form>
</body>
</html>
怎样判断与数据库连接成功??
多多指教!! --------------------编程问答-------------------- 自己顶 --------------------编程问答-------------------- 你自己写个页面测试下不就好了。 --------------------编程问答-------------------- 不会测试,能说具体些吗? --------------------编程问答-------------------- 怎么没人回答 --------------------编程问答-------------------- 你直接连接数据库,打印提示不就行了。
try
{
//conn.Open();
//打印提示
}
catch
{
}
你也可以单步调试看是否出错啊 --------------------编程问答-------------------- eee我试试 谢谢 --------------------编程问答-------------------- 用try
补充:.NET技术 , ASP.NET