<%@ WebService Language="C#" Class="E.GetData" %> using System; using System.Data; using MySql.Data.MySqlClient; using System.Web.Services; namespace E { public class GetData : WebService { [WebMethod] public string GetF2(int f1) { MySqlConnection con = new MySqlConnection("Database=Test;Data Source=localhost;User Id=;Password="); con.Open(); MySqlCommand sel = new MySqlCommand("SELECT f2 FROM t1 WHERE f1 = ?f1", con); sel.Parameters.Add("?f1", MySqlDbType.Int32); sel.Parameters["?f1"].Value = f1; string res = (string)sel.ExecuteScalar(); con.Close(); return res; } } }