I am trying to connect to a sql database and read from a table to determine if a username is valid upon a user entering in theirs. To just give you a background of the program:

1. The user needs to enter in their username and ID number. I already have a way to check if the ID is correct.

2. The username needs to match one that is in the sql database within a table. If not then it will display an error message.

If someone could show me how to connect to the database correctly then that would be great because the code I have been using has not been showing the results I need.

Also how to check if the username is correct based on the database table.

Thanks!

Recommended Answers

All 5 Replies

Please use the forum search tool. I see this question asked multiple times a day. I'm sure at least one of them has been answered.

What are you doing, some kind of a login?

Please use the forum search tool. I see this question asked multiple times a day. I'm sure at least one of them has been answered.

I see it to but its for regular c#, I am doing this is asp.net code-behind so its coded a little differently.

I have been looking but I will continue to do so if no one can help me!

Thank you!

What are you doing, some kind of a login?

I login page is already made in vb.net. This page is an option that a user can select. It will have them input their username and id. I just need to check if that username is correct based on a sql database.

I see it to but its for regular c#, I am doing this is asp.net code-behind so its coded a little differently.

I have been looking but I will continue to do so if no one can help me!

Thank you!

As far as I'm aware, ASP.NET code-behind is C# and can be treated as such, also, there is an ASP.NET forum as well ;)

As far as the C# is concerned, you may want to look at using a webservice for your data access layer otherwise, depending on user load, you may find your site waiting for database connectivity as the number of concurrent connections approaches the limit.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.