“Application” Variable Web Application
How do I create an “agent” who will be running automatically when a page in the web application is run? “Agent” runs only once a day, no more. In fact this web page is accessed by many people per day.
Here are some solutions:
1. Save the date in the database. Weaknesses: would be too frequent connection to the database server, the server Will be busy …
2. Save the date in the Application variable. Put this code into your default page :
if (!IsPostBack)
{
if (Application[“date”] != null)
{
if (Convert.ToDateTime(Application[“date”]) != DateTime.Today)
{
Application[“date”] = DateTime.Today;
//do something
}
}
else
{
Application[“movingdate”] = DateTime.Today;
//do something
}
}
Application variables are very similar to the Session. Session will run out if the web page was closed. Meanwhile, the Application would not run out even though the web page is closed. So in the Application, the values will be stored on, except for Servers to die then it will return an empty / null.
Ok, may it helps
Thanks
Export to Excel and Word Configuration
How to configure web server that used by web application to export data to Excel or Word ?
Below is step by step :
To Excel :
1. Click Run – type dcomcnfg – show Component Services menu.
2. Right Click on DCOM Config tree – Microsoft Excel Application – select Properties.
3. On the security tab add user ASP.Net Machine Account, IISUser, and Administrators in each group.
4. Click OK – close Component Services menu.
To Word :
1. Click Run – type dcomcnfg – show Component Services menu.
2. Right Click on DCOM Config tree – Microsoft Office Word Document – select Properties.
3. On the security tab add user ASP.Net Machine Account, IISUser, and Administrators in each group.
4. On the identity tab – select This User, and type Administrator username & password .
5. Click OK – close Component Services menu.
Ok, may it helps
Thanks
Connect to MySQL Remote Server
How to configure MySQL Server in order to be able connected by remote computer.
Here are step by step to configure it :
1. Login into MySQL Management Server. Usual address on http://localhost:8080/phpmyadmin/
2. Click Privilege
3. Click Add New User
4. In the Login Information field, type it :
– UserName – Use Text Field = “username”
– Host – Any host = “”
– Password – Use Text Field = “password”
– Re-type = “password”
5. On Global Privilege field, please select as needed
6. Click Go
Ok, May it helps,
Thanks
SQLYog Community
There are a lot of MySQL User Interface. One of them is SQLYog Community
It’s free, light, and has similarity as Query Analyzer in Microsoft Sql Server.
Here a snapshoot :
Ok, May it helps
Thanks
Execute MySQL Stored Procedure From .Net
Here is the example code to execute MySql Stored Procedure using .Net and C# syntax, by sending a parameters into Stored Procedure. Let’s say that we have “GetDataMahasiswa” Stored Procedure.
1. Add Reference MySql.Data.dll
2. Type the code :
public List<string> GetDataMahasiswa()
{
List<string> listNama = null;
string spName = “GetDataMahasiswa”;
// Connection String
string connString = “SERVER=localhost;” +
“DATABASE=myfirst;” +
“UID=root;” +
“PASSWORD=123;”;
MySqlConnection conn = new MySqlConnection(connString);
MySqlCommand command = conn.CreateCommand();
MySqlDataReader reader;
command.CommandText = “call ” + spName + “(‘9’)”;
conn.Open();
reader = command.ExecuteReader();
if (reader.HasRows)
{
listNama = new List<string>();
while (reader.Read())
{
// Read the value…
string value = reader[“Nama”].ToString().Trim();
listNama.Add(value);
}
}
conn.Close();
return listNama;
}
May it helps,
Thanks
Queries to Get Row Number
Here tricks queries to get row number
There is a table “MsUser” contains fields ID & Name :
0860101 Budi
0891010 Iwan
0891200 Bayu
0902310 Donny
The query could be like this below
Select a.ID,a.Name,(Select count(*) From MsUser Where ID < a.ID) From MsUser a
The results are :
0860101 Budi 0
0891010 Iwan 1
0891200 Bayu 2
0902310 Donny 3
Those are incase we are using SQL Server 2000
It would be not necessary when we are using SQL Server 2005. The query to show record number has already provided. Let’s see query below :
Select ID, Name, row_number() over (order by ID asc) from MsUser
The results are :
0860101 Budi 1
0891010 Iwan 2
0891200 Bayu 3
0902310 Donny 4
May it Helps
Thanks