Dosya okuma

SqlCommand cmd = new SqlCommand();
SqlDataAdapter da = new SqlDataAdapter(cmd);
cmd.Connection = Mainform.baglan;

        string yol = Application.StartupPath;
        StreamReader oku = new StreamReader(yol + "\\Sql\\FormAntepSatis.sql", Encoding.UTF8);
        string okunan = oku.ReadToEnd();

        cmd.CommandText = okunan;//.Replace("TOP 10", "TOP 3");

        cmd.CommandText = okunan.Replace("055", firma);
      //  cmd.CommandText = okunan;


        if (Mainform.dsGenel.Tables.Contains("Umt_055_AylikSatisStokluAntep"))
        {
            Mainform.dsGenel.Tables.Remove("Umt_055_AylikSatisStokluAntep");
        }

        try
        {
            Mainform.baglantiac();
            da.Fill(Mainform.dsGenel, "Umt_055_AylikSatisStokluAntep");
            gridControl1.DataSource = Mainform.dsGenel.Tables["Umt_055_AylikSatisStokluAntep"];
        }
  • No Tags

Comments are closed

read more latest blog