Thursday, July 3, 2014

Fill dataset from database in asp.net

  public DataSet GetInstrument(string InvesterType)
        {
            DataSet ds = new DataSet();

            string cmdstr = @"SELECT  AssetClass
FROM  AssetClass
WHERE (InvestorType = '" + InvesterType + "')";
            myConnection.Open();
            SqlCommand cmd = new SqlCommand(cmdstr, myConnection);
            SqlDataAdapter adp = new SqlDataAdapter(cmd);
            adp.Fill(ds);
            myConnection.Close();
            return ds;

        }

No comments:

Post a Comment