如何用C#显示数据库中的数据结果
我正在尝试使用 Visual Studio 2010 在 C# 和 .accdb 数据库中制作一个网站 我的 .accdb 数据库有用户名和分数,我想显示 Default.aspx 的信用值大于 0 的用户,
所以我创建了一个按钮和一个文本框。
<div>
<asp:Button ID="CreditSearch" runat="server" Text="Credit" onclick="btnCreditSearch_Click" />
</div>
btnCreditSearch_Click 的函数是:
protected void btnCreditSearch_Click(object sender, EventArgs e)
{
CreditSearch();
}
private void CreditSearch()
{
string users;
users = Process.UserCreditSearch();
string A = users.ToString();
TextBox1.Text(A);
}
我的 Process.UserCreditSearch() 是:
public static string UserCreditSearch()
{
string query = "SELECT srusername FROM usertb WHERE credit > 0 ";
return query;
}
但它不起作用。对于信用搜索功能,它说“不可调用的成员'System.UI.Webcontrol.TextBox.Text'不能像方法一样使用
我希望有人知道我做错了什么,谢谢
I am trying to make a website in C# and .accdb database using Visual Studio 2010
my .accdb database has username and score and I want to display the user that has credit more than 0 to the Default.aspx
So I created a button and a textbox.
<div>
<asp:Button ID="CreditSearch" runat="server" Text="Credit" onclick="btnCreditSearch_Click" />
</div>
and the function for btnCreditSearch_Click is:
protected void btnCreditSearch_Click(object sender, EventArgs e)
{
CreditSearch();
}
private void CreditSearch()
{
string users;
users = Process.UserCreditSearch();
string A = users.ToString();
TextBox1.Text(A);
}
and my Process.UserCreditSearch() is:
public static string UserCreditSearch()
{
string query = "SELECT srusername FROM usertb WHERE credit > 0 ";
return query;
}
but then it is not working. for the credit search function, it says "Non invocable member' System.UI.Webcontrol.TextBox.Text' can not be use like a method
I hope somebody knows what I done wrong and thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
.Text 是一个属性
.Text is a Property