Friday, July 7, 2017

Display Distinct Record set in label SQL Server C# asp.nrt

 SqlConnection myConnection = new SqlConnection(ConnectionStringrk);
        string strSQL;
        strSQL = "select adan8 from mfdb.proddta.f550092 where aduser ='" + TextBox7.Text + "'";
        //Response.Write(strSQL);
        //Response.End();

        //
        SqlCommand cmd = new SqlCommand(strSQL, myConnection);
        cmd.CommandTimeout = 50;
        cmd.CommandType = CommandType.Text;
        myConnection.Open();
        Label11125.Text = cmd.ExecuteScalar().ToString();
        myConnection.Close();

No comments: