Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.ComponentModel;
- using System.Data;
- using System.Linq;
- using System.Web;
- using System.Web.Services;
- using System.Web.Services.Protocols;
- using System.Xml.Linq;
- using System.Data.SqlClient;
- namespace LoginDetails
- {
- /// <summary>
- /// Summary description for Service1
- /// </summary>
- [WebService(Namespace = "http://tempuri.org/")]
- [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
- [ToolboxItem(false)]
- // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
- // [System.Web.Script.Services.ScriptService]
- public class Service1 : System.Web.Services.WebService
- {
- SqlConnection myConnection = new SqlConnection(@"Data Source=.\SQLEXPRESS;Initial Catalog=student;User ID=sa;Password=123");
- [WebMethod]
- public String GetLoginDetails(string UserName, string Password)
- {
- try
- {
- myConnection.Open();
- SqlCommand myCommand = new SqlCommand();
- myCommand.Connection = myConnection;
- myCommand.CommandText = "select * from Login where UserName = '" + UserName + "' and Password='" + Password + "'";
- SqlDataReader myReader = myCommand.ExecuteReader();
- }
- catch (Exception ex)
- {
- Console.WriteLine(ex.Message);
- }
- finally
- {
- myConnection.Close();
- }
- return "success";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement