string strsql="SELECT name,two form thename"; ===> ^^^^^^^ from, not form string strsql="SELECT name,two from thename";
To saucer(思归, MS .NET MVP) 刚才已经改过了,可还是不行,,,麻烦再帮俺看看好吗???
debug into the code, make sure you do have datastring strsql="SELECT [name],two from thename";...System.Text.StringBuilder a = new System.Text.StringBuilder(); try { objconnection.Open(); objdatareader=objcommand.ExecuteReader(); while(objdatareader.Read()) { a.AppendFormat("{0} {1}<br/>", objdatareader["name"], objdatareader["two"]); } objdatareader.Close(); objconnection.Close(); show.InnerHtml=a.ToString(); } catch(Exception ex) { Response.Write("***" + ex.Message + "****"); }
to saucer(思归, MS .NET MVP)你的有些代码我看不懂啊,我是新手不过你哪些代码和我的也没什么什么本质区别呀,,,我想知道我到底错在哪里?为什么显示不出来???
To xrll() 你哪调试能通过吗???能显示出来数据吗???
strconnection+=@"Data Source=d:\aspasp\first.mdb"; string strsql="SELECT name,two form thename"; 其中的form改为from就正常了,我已经试过!
you have a catch(){}it catches all errors, my code catch(Exception ex) { Response.Write("***" + ex.Message + "****"); } let you know if there are any errors
a+=objdatareader["name"].ToString();
a+="<br> ";
a+=objdatareader["two"].ToString();
a+="<br/>";
}
===> ^^^^^^^ from, not form
string strsql="SELECT name,two from thename";
try
{
objconnection.Open();
objdatareader=objcommand.ExecuteReader();
while(objdatareader.Read())
{
a.AppendFormat("{0} {1}<br/>", objdatareader["name"], objdatareader["two"]);
}
objdatareader.Close();
objconnection.Close();
show.InnerHtml=a.ToString();
}
catch(Exception ex)
{
Response.Write("***" + ex.Message + "****");
}
<%@ Import Namespace="System.Data.OleDb"%>
<script language="c#" runat="server">
void Page_load()
{
string strconnection="Provider=Microsoft.Jet.OleDb.4.0;";
strconnection+=@"Data Source=G:\antai\first.mdb";
string strsql="SELECT name,two from thename";
OleDbConnection objconnection=new OleDbConnection(strconnection);
OleDbCommand objcommand=new OleDbCommand(strsql,objconnection);
OleDbDataReader objdatareader=null;
string a="";
try
{
objconnection.Open();
objdatareader=objcommand.ExecuteReader();
while(objdatareader.Read()==true)
{
a+=objdatareader["name"];
a+=@" ";
a+=objdatareader["two"];
a+="<br/>";
}
objdatareader.Close();
objconnection.Close();
show.InnerHtml=a;
}
catch{}
}
</script>
<html>
<div id="show" runat="server">list</div>
</html>
string strsql="SELECT name,two form thename";
其中的form改为from就正常了,我已经试过!
catch(){}it catches all errors, my code catch(Exception ex)
{
Response.Write("***" + ex.Message + "****");
}
let you know if there are any errors
直接下载2.7sp1中文版然后下载.NET Framework 1.1版可再发行组件包
http://www.microsoft.com/downloads/details.aspx?familyid=262D25E3-F589-4842-8157-034D1E7CF3A3&displaylang=zh-cn
直接下载然后下载.NET Framework SDK1.1安装http://www.microsoft.com/downloads/details.aspx?displaylang=zh-cn&FamilyID=9B3A2CA6-3647-4070-9F41-A333C6B9181D
下载1.1简体中文版最后安装简体中文语言包
http://www.microsoft.com/downloads/details.aspx?familyid=04DBAF2E-61ED-43F4-8D2A-CCB2BAB7B8EB&displaylang=zh-cn
直接下载