文件读取问题 StreamReader sr = new StreamReader(@"C:\1.txt", UnicodeEncoding.GetEncoding("GBK"));string txt = sr.ReadToEnd();textBox1.Text = txt; 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 label1.Text = sr.ReadToEnd();或者textBox1.Text = sr.ReadToEnd(); 晕,你也太小白了!label和textbox是控件名称,你要先添加控件才能用啊! 不行那你这是web的还是winfrom的?winform的要在窗体上面放一个Lable或者TextBox控件啊 控件添加了,在.aspx中啊,这个是写在.aspx.cs中的 不行那你这是web的还是winfrom的?winform的要在窗体上面放一个Lable或者TextBox控件啊是Web 不行那你这是web的还是winfrom的?winform的要在窗体上面放一个Lable或者TextBox控件啊是Web页面上加上下面代码<asp:TextBox ID="TextBox1" runat="server" Height="105px" TextMode="MultiLine" Width="320px"></asp:TextBox> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> 不行那你这是web的还是winfrom的?winform的要在窗体上面放一个Lable或者TextBox控件啊是Web页面上加上下面代码<asp:TextBox ID="TextBox1" runat="server" Height="105px" TextMode="MultiLine" Width="320px"></asp:TextBox> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>我这个写在.aspx中了 看看Label ID="Label1"是否匹配 不行那你这是web的还是winfrom的?winform的要在窗体上面放一个Lable或者TextBox控件啊是Web页面上加上下面代码<asp:TextBox ID="TextBox1" runat="server" Height="105px" TextMode="MultiLine" Width="320px"></asp:TextBox> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>我这个写在.aspx中了你确定是写在当前页面中了? 不行那你这是web的还是winfrom的?winform的要在窗体上面放一个Lable或者TextBox控件啊是Web页面上加上下面代码<asp:TextBox ID="TextBox1" runat="server" Height="105px" TextMode="MultiLine" Width="320px"></asp:TextBox> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>我这个写在.aspx中了你确定是写在当前页面中了? 不行那你这是web的还是winfrom的?winform的要在窗体上面放一个Lable或者TextBox控件啊是Web页面上加上下面代码<asp:TextBox ID="TextBox1" runat="server" Height="105px" TextMode="MultiLine" Width="320px"></asp:TextBox> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>我这个写在.aspx中了你确定是写在当前页面中了?是的,我写在WebForm2.aspx和WebForm2.aspx.cs中的 你在这个方法外面点一下这个控制看能不能点出来 this.TextBox.Text=""看下能不能点的出来 不能显示的是TextBox1不存在你仔细对下,有加红的代码么?<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> 不能显示的是TextBox1不存在你仔细对下,有加红的代码么?<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> <td> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> </td>有 不能显示的是TextBox1不存在你仔细对下,有加红的代码么?<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>应该是我前面写的读出文本的代码有问题吧 不行那你这是web的还是winfrom的?winform的要在窗体上面放一个Lable或者TextBox控件啊不行那你这是web的还是winfrom的?winform的要在窗体上面放一个Lable或者TextBox控件啊protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { //连接数据库 string sqlconnstr = ConfigurationManager.ConnectionStrings["connection"].ConnectionString; DataSet ds = new DataSet(); using (SqlConnection sqlconn = new SqlConnection(sqlconnstr)) { String ztid = Request.QueryString["ztID"]; //读取文件 SqlDataAdapter sqld = new SqlDataAdapter("select useid,ctTime,ctZw,floor from congtie where ztID='" + ztid.ToString() + "' ", sqlconn); DataTable dt = new DataTable(); sqld.Fill(dt); foreach (DataRow dr in dt.Rows) { StreamReader sr = new StreamReader(dr["ctZw"].ToString()); Response.Write(sr.ReadToEnd()); string txt = sr.ReadToEnd(); this.TextBox2.Text = txt; sr.Close(); } sqld.Fill(ds, "tabct"); } DataList1.DataSource = ds.Tables["tabct"].DefaultView; DataList1.DataBind(); } }ctZw在数据库中存放文本的路径,想给它读出来,显示在Label或者TextBox中 把你aspx代码全贴出来。form里啊 把你aspx代码全贴出来。无力了。 把你aspx代码全贴出来。无力了。 <form id="form1" runat="server" > <div> <asp:DataList ID="DataList1" runat="server" style="margin-top: 0px" Width="718px" Height="278px" align="center" > <ItemTemplate> <table width="500" border="1" > <tr> <td width="100" rowspan="3" class="manage_lines1"> 用户:<%#Eval("useid ")%></td> <td> <table width="400" border="1"> <tr><td> 发表于:<%#Eval("ctTime")%># <%#Eval("floor")%> </td> </tr> <tr> <td> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> </td> </tr> <tr> <td align="right"> <asp:LinkButton ID="LinkButton1" runat="server" Text="回复" href="#TextBox1" /> <asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="赞" /> </td> </tr> </table> </td> </tr> </table> </ItemTemplate> </asp:DataList> </div> <div> <table border="1" style="height:240px; width: 500px"align="center"> <tr > <td> <asp:TextBox ID="TextBox1" runat="server" Width="500" Height="200" TextMode="MultiLine"></asp:TextBox> </td> </tr> <tr align="right"> <td class="auto-style1"> <asp:Button ID="Button3" runat="server" OnClick="Button3_Click" Text="发帖" /> <asp:Button ID="Button4" runat="server" OnClick="Button4_Click" Text="取消" Height="21px" /> </td> </tr> </table> </div> </form> 看下aspx对应的designer.cs文件中是不是缺少Label和TextBox的定义,缺少的话加上去 WinForm关闭窗体问题。 请大家 帮我看看这段代码在格式上 有没有什么问题。 c#里的矩阵运算,有没有现成的类或者方法? c#在Winform中怎么获取DataGrid当前选定行对应的数据(50分求解) 数组属性如何实现,高手来帮忙 [求助]关于c# 制作Pocket PC程序 ~ c# 循环打印 未在本地计算机上注册“Ifxoledbc.2"提供程序,高手帮忙啊!急 窗体设计视图崩溃问题 征求关于PB与C#的比较! C#里面下载文件的问题 怎么实现八戒侧边栏的效果
或者
textBox1.Text = sr.ReadToEnd();
label和textbox是控件名称,你要先添加控件才能用啊!
不行那你这是web的还是winfrom的?
winform的要在窗体上面放一个Lable或者TextBox控件啊
不行那你这是web的还是winfrom的?
winform的要在窗体上面放一个Lable或者TextBox控件啊
是Web
不行那你这是web的还是winfrom的?
winform的要在窗体上面放一个Lable或者TextBox控件啊
是Web页面上加上下面代码
<asp:TextBox ID="TextBox1" runat="server" Height="105px" TextMode="MultiLine"
Width="320px"></asp:TextBox>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
不行那你这是web的还是winfrom的?
winform的要在窗体上面放一个Lable或者TextBox控件啊
是Web页面上加上下面代码
<asp:TextBox ID="TextBox1" runat="server" Height="105px" TextMode="MultiLine"
Width="320px"></asp:TextBox>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
我这个写在.aspx中了
不行那你这是web的还是winfrom的?
winform的要在窗体上面放一个Lable或者TextBox控件啊
是Web页面上加上下面代码
<asp:TextBox ID="TextBox1" runat="server" Height="105px" TextMode="MultiLine"
Width="320px"></asp:TextBox>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
我这个写在.aspx中了你确定是写在当前页面中了?
不行那你这是web的还是winfrom的?
winform的要在窗体上面放一个Lable或者TextBox控件啊
是Web页面上加上下面代码
<asp:TextBox ID="TextBox1" runat="server" Height="105px" TextMode="MultiLine"
Width="320px"></asp:TextBox>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
我这个写在.aspx中了你确定是写在当前页面中了?
不行那你这是web的还是winfrom的?
winform的要在窗体上面放一个Lable或者TextBox控件啊
是Web页面上加上下面代码
<asp:TextBox ID="TextBox1" runat="server" Height="105px" TextMode="MultiLine"
Width="320px"></asp:TextBox>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
我这个写在.aspx中了你确定是写在当前页面中了?
是的,我写在WebForm2.aspx和WebForm2.aspx.cs中的
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<td>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</td>
有
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
应该是我前面写的读出文本的代码有问题吧
不行那你这是web的还是winfrom的?
winform的要在窗体上面放一个Lable或者TextBox控件啊
不行那你这是web的还是winfrom的?
winform的要在窗体上面放一个Lable或者TextBox控件啊
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
//连接数据库
string sqlconnstr = ConfigurationManager.ConnectionStrings["connection"].ConnectionString;
DataSet ds = new DataSet();
using (SqlConnection sqlconn = new SqlConnection(sqlconnstr))
{
String ztid = Request.QueryString["ztID"];
//读取文件
SqlDataAdapter sqld = new SqlDataAdapter("select useid,ctTime,ctZw,floor from congtie where ztID='" + ztid.ToString() + "' ", sqlconn);
DataTable dt = new DataTable();
sqld.Fill(dt);
foreach (DataRow dr in dt.Rows)
{
StreamReader sr = new StreamReader(dr["ctZw"].ToString());
Response.Write(sr.ReadToEnd());
string txt = sr.ReadToEnd();
this.TextBox2.Text = txt;
sr.Close();
}
sqld.Fill(ds, "tabct");
}
DataList1.DataSource = ds.Tables["tabct"].DefaultView;
DataList1.DataBind();
} }ctZw在数据库中存放文本的路径,想给它读出来,显示在Label或者TextBox中
<div>
<asp:DataList ID="DataList1" runat="server" style="margin-top: 0px" Width="718px"
Height="278px" align="center"
>
<ItemTemplate>
<table width="500" border="1" >
<tr>
<td width="100" rowspan="3" class="manage_lines1">
用户:<%#Eval("useid ")%></td>
<td>
<table width="400" border="1">
<tr><td>
发表于:<%#Eval("ctTime")%># <%#Eval("floor")%>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</td>
</tr>
<tr>
<td align="right">
<asp:LinkButton ID="LinkButton1" runat="server" Text="回复" href="#TextBox1" />
<asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="赞" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
</div> <div>
<table border="1" style="height:240px; width: 500px"align="center">
<tr >
<td>
<asp:TextBox ID="TextBox1" runat="server" Width="500" Height="200" TextMode="MultiLine"></asp:TextBox>
</td>
</tr>
<tr align="right">
<td class="auto-style1">
<asp:Button ID="Button3" runat="server" OnClick="Button3_Click" Text="发帖" />
<asp:Button ID="Button4" runat="server" OnClick="Button4_Click" Text="取消"
Height="21px" />
</td>
</tr>
</table>
</div> </form>