// GET: Login public ActionResult Index() { Intialpage obj = loginData.Select_Text(); ViewBag.textPart = obj.textPart; return(View()); }
public static Intialpage Select_Text() { Intialpage pageObj = new Intialpage(); SqlConnection connection = plansoni_webstoreData.GetConnection(); string selectProcedure = "[LoginSelectImgText]"; SqlCommand selectCommand = new SqlCommand(selectProcedure, connection); selectCommand.CommandType = CommandType.StoredProcedure; try { connection.Open(); SqlDataReader reader = selectCommand.ExecuteReader(CommandBehavior.SingleRow); if (reader.Read()) { pageObj.textPart = System.Convert.ToString(reader["TextPart"]); pageObj.imagePath = System.Convert.ToString(reader["ImagePath"]); } else { pageObj = null; } reader.Close(); } catch (SqlException) { return(pageObj); } finally { connection.Close(); } return(pageObj); }