default.aspx.cs中定义的dataset在default.aspx总是null
大家知道这是为什么么?cs中代码:(权限已经最大了)publicDataSetds;publicstringds1;publicOleDbCommandcmd;publi...
大家知道这是为什么么?
cs中代码:(权限已经最大了)
public DataSet ds;
public string ds1;
public OleDbCommand cmd;
public OleDbConnection con;
public OleDbDataAdapter da;
public void Page_Load(object sender, EventArgs e)
{
OleDbConnection con = new OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;data source=" + Server.MapPath("App_Data\\mydata.mdb"));
con.Open();
OleDbCommand cmd = new OleDbCommand("select * from mynews", con);
aspx中代码
<MARQUEE onmouseover=this.stop() onmouseout=this.start()
scrollAmount=1 scrollDelay=10 direction=up height=150>
<TABLE cellSpacing=0 cellPadding=0 width=210 align=center
border=0><TBODY>
<%
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{ %>
<TR>
<TD class=hei height=50>
<DIV align=center><A
href="http://www.jpkcnet.com/new/buletin/buletin_detail.asp?buletin_id=14"
target=_blank>2010年国家精品课程申报系统已开通</A>
[2010-3-16]<BR><BR></DIV></TD></TR>
<%} %>
<TR>
<TD class=hei height=50>
<DIV align=center><A
href="http://www.jpkcnet.com/new/buletin/buletin_detail.asp?buletin_id=8"
target=_blank>2007年国家精品课程公示名单已经发布 !!!</A>
[2007-10-18]<BR><BR></DIV></TD></TR></TBODY></TABLE></MARQUEE>
// OleDbCommand insertcmd = new OleDbCommand("insert into [table](name,age) values ('" + i + "'," + j + ")", con);
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, "mynews");
} 展开
cs中代码:(权限已经最大了)
public DataSet ds;
public string ds1;
public OleDbCommand cmd;
public OleDbConnection con;
public OleDbDataAdapter da;
public void Page_Load(object sender, EventArgs e)
{
OleDbConnection con = new OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;data source=" + Server.MapPath("App_Data\\mydata.mdb"));
con.Open();
OleDbCommand cmd = new OleDbCommand("select * from mynews", con);
aspx中代码
<MARQUEE onmouseover=this.stop() onmouseout=this.start()
scrollAmount=1 scrollDelay=10 direction=up height=150>
<TABLE cellSpacing=0 cellPadding=0 width=210 align=center
border=0><TBODY>
<%
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{ %>
<TR>
<TD class=hei height=50>
<DIV align=center><A
href="http://www.jpkcnet.com/new/buletin/buletin_detail.asp?buletin_id=14"
target=_blank>2010年国家精品课程申报系统已开通</A>
[2010-3-16]<BR><BR></DIV></TD></TR>
<%} %>
<TR>
<TD class=hei height=50>
<DIV align=center><A
href="http://www.jpkcnet.com/new/buletin/buletin_detail.asp?buletin_id=8"
target=_blank>2007年国家精品课程公示名单已经发布 !!!</A>
[2007-10-18]<BR><BR></DIV></TD></TR></TBODY></TABLE></MARQUEE>
// OleDbCommand insertcmd = new OleDbCommand("insert into [table](name,age) values ('" + i + "'," + j + ")", con);
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, "mynews");
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询