using MySql.Data.MySqlClient; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Web; using System.Web.Services; namespace WebApplication1 { /// /// Summary description for myapp /// [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.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 myapp : WebService { [WebMethod] public login logins(string id, string pass) { MySqlConnection conn = new MySqlConnection(new dnconn().dbconn); login log = new login(); try { MySqlCommand cmd = new MySqlCommand("getlogin", conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("id1", MySqlDbType.VarChar, 70).Value = id; cmd.Parameters.Add("code2", MySqlDbType.VarChar, 70).Value = pass; cmd.Connection = conn; if (conn.State == ConnectionState.Closed) conn.Open(); MySqlDataReader reader = cmd.ExecuteReader(); if (reader.HasRows) { log.validuser = true; return log; } } catch (Exception ex) { log.eroor = ex.ToString(); } finally { conn.Close(); } return log; } [WebMethod(MessageName = "Getcite", Description = "Return contact data from DB")] public List Getcite() { MySqlConnection conn = new MySqlConnection(new dnconn().dbconn); var cito = new List(); try { MySqlCommand cmd = new MySqlCommand("getreg", conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = conn; if (conn.State == ConnectionState.Closed) conn.Open(); MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { cito.Add(new cite(reader["CREGIE"].ToString(), reader["NREGIE"].ToString(), null)); } } catch (Exception ex) { cito.Add(new cite(null, null, ex.ToString())); } finally { conn.Close(); } return cito; } } }