// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Data; using System.Data.SqlClient; public class Test : MarshalByRefObject { public string findf2(int f1) { SqlConnection con = new SqlConnection("server=ARNEPC2;Integrated Security=SSPI;database=Test"); con.Open(); SqlCommand cmd = new SqlCommand("SELECT F2 FROM T1 WHERE F1="+f1, con); SqlDataReader rdr = cmd.ExecuteReader(); rdr.Read(); string res = (string)rdr[0]; con.Close(); return res; } }