| Server IP : 199.79.62.161 / Your IP : 216.73.216.245 [ Web Server : Microsoft-IIS/10.0 System : Windows NT MDUS-PP-WB12 10.0 build 20348 (Windows Server 2022) AMD64 User : IWPD_5096(nirmaowd) ( 0) PHP Version : 8.3.30 Disable Function : NONE Domains : 0 Domains MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : D:/INETPUB/VHOSTS/nirmalamatha.edu.in/ponnuguruvayurappan.org/Admin/ |
Upload File : |
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web;
public partial class admin_edit_photogallery_group : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Request.QueryString["gid"] == "" || Request.QueryString["gid"] == null)
Response.Redirect("message.aspx?msg=Please try later!");
else
{
LoadDetails(Request.QueryString["gid"]);
}
}
}
public void LoadDetails(string GID)
{
SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["myconnectionstring"].ConnectionString);
SqlDataAdapter dbAdapt = new SqlDataAdapter("SELECT * FROM [PHOTOGALLERYGROUPS] WHERE GID = " + GID + "", dbConn);
dbAdapt.MissingSchemaAction = MissingSchemaAction.AddWithKey;
SqlCommandBuilder dbCB = new SqlCommandBuilder(dbAdapt);
dbConn.Open();
DataSet dbSet = new DataSet();
dbAdapt.Fill(dbSet, "temp");
DataTable dbTable = dbSet.Tables["temp"];
// checking data exits
if (dbTable.Rows.Count == 1)
{
txt_Name.Text = dbTable.Rows[0]["GroupName"].ToString();
txt_DisplayOrder.Text = dbTable.Rows[0]["DisplayOrder"].ToString();
}
else
{
Response.Redirect("message.aspx?msg=No Data Found");
}
}
protected void btnUpload_Click(object sender, EventArgs e)
{
try
{
string gid = Request.QueryString["gid"];
//********* add to db
SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["myconnectionstring"].ConnectionString);
SqlDataAdapter dbAdapt = new SqlDataAdapter("SELECT * FROM [PHOTOGALLERYGROUPS] WHERE GID = " + gid + "", dbConn);
// We need this to get an ID back from the database
dbAdapt.MissingSchemaAction = MissingSchemaAction.AddWithKey;
// Create and initialize CommandBuilder
SqlCommandBuilder dbCB = new SqlCommandBuilder(dbAdapt);
// Open Connection
dbConn.Open();
// New DataSet
DataSet dbSet = new DataSet();
// Populate DataSet with data
dbAdapt.Fill(dbSet, "temp");
// Get reference to our table
DataTable dbTable = dbSet.Tables["temp"];
// checking data exits
if (dbTable.Rows.Count == 1)
{
DataRow dbRow = dbTable.Rows[0];
//********* file save
dbRow["GroupName"] = txt_Name.Text.Trim();
dbRow["DisplayOrder"] = int.Parse(txt_DisplayOrder.Text);
int stat = dbAdapt.Update(dbSet, "temp");
dbConn.Close();
//********* end of save to db
if (stat > 0)
Response.Redirect("add_photogallery_group.aspx?msg= Successfully Updated#msg");
else
Response.Redirect("add_photogallery_group.aspx?msg= Please Try Later#msg");
}
}
catch (Exception info)
{
throw info;
}
}
}