using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using MvcVoucher.Models; using System.Data; using System.Data.SqlClient; using System.Configuration; namespace MvcVoucher.Controllers { public class HeaderController : Controller { public ActionResult HeaderView() { Header1Controller obj = new Header1Controller(); SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["MYDATA"].ConnectionString); DataSet ds = new DataSet(); con.Open(); string strSelectCmd = "SELECT ([empno] +'-'+ [name]) as[empname],(PA +'-'+ PATXT) as pa,(PSA +'-'+ PSATXT) as [psa],OU,(CO_CODE +'-'+ CO_TXT) as [Companycode],PLAN1,CURRENCY from dbo.zemp_tbl_rohit WHERE empno = '00019904'"; SqlDataAdapter da = new SqlDataAdapter(strSelectCmd, con); da.Fill(ds); obj.PA = Convert.ToString(ds.Tables[0].Rows[0][1]); obj.NIITianCode = Convert.ToString(ds.Tables[0].Rows[0][0]); obj.OU = Convert.ToString(ds.Tables[0].Rows[0][3]); obj.PSA = Convert.ToString(ds.Tables[0].Rows[0][2]); obj.CompanyCode = Convert.ToString(ds.Tables[0].Rows[0][4]); obj.Currency = Convert.ToString(ds.Tables[0].Rows[0][6]); obj.Plan = Convert.ToString(ds.Tables[0].Rows[0][5]); ViewBag.message = "hello"; con.Close(); ViewData.Model = obj; return View(ViewData.Model); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)