C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » ASP.NET »

compare value with database in asp.net


Posted Date: 15 Oct 2008      Posted By: amitkumar      Member Level: Gold     Points: 1   Responses: 2



Hi,

Am creating a mailmessage to sending the email from my asp.net page, i have a field to enter the mobile number ., i want to compare this entered mobile number with my sql db table.If the entered mobile number is there there it has to send a mail to user that 'U r an autharized person' or else'not autharized.

How will i do it using asp.net web application.

Thanks





Responses

Author: gomathinayagam    15 Oct 2008Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

sqlcommand cmd ="select * from table where mobileno='" + textbox.text;
SqlDataAdapter oda = new SqlDataAdapter(cmd);
cmd.connection = new sqlconnection("connection string");
cmd.open();
DataTable dt = new DataTable();
oda.Fill(dt);
if (dt.Rows.Count > 0)
{
// authorized
}
else
{
//not authorized
}

Gomathi Nayagam

Please Rate my answer if it has helpful to you



Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : hi All How To Send Mail Through ASP. Any Free SMTP Server
Previous : i want leatn ajax with asp.net 2.0
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use