How to display data result from database in C#
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();
T开发者_运维百科extBox1.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
.Text is a Property
TextBox1.Text= A;
精彩评论