0

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

0

1 Answer 1

1

.Text is a Property

TextBox1.Text= A;
Sign up to request clarification or add additional context in comments.

4 Comments

thanks now I changed to TextBox1.Text= A; but now the textbox displayed "SELECT srusername FROM usertb WHERE credit > 0 " but what I want is the users that has credits larger than 0 Is there any problem of the code that causing this?
string query = "SELECT srusername FROM usertb WHERE credit > 0 "; //this is wrong because select statement return a table you are assigning it to a string and there must be a connection handling class
@Ric: Where is your connection class?
@Ric: what do you do if you get back multiple users with credit > 0 ??

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.