File Upload Control With Regular Expression Validation Control In asp.net 4.0 With Ajax


Aryan Verma

https://orientprogrammer.wordpress.com
Step 1: Make A New Web Site Using IDE 4.0 (Visual Studio 2010)
and after clicking on new web site you will get interface look as below given.


Step 2: Now place given control in code or can write to these.

.style1
{
color: #FF9900;
}

File Upload Control With Regular Expression Validator And Validations On Image Uploading
Upload Gravatar

Now Run and Enjoy In This .net World

Advertisements

How to get table,database size in Sql Server


In this article,i would share with you, how to get size of the tables in database in sql server.When you are move your database to production, then you have to check the database size once week or month. becuase host provider give the limited database capacity.

EXEC sp_spaceused

In above Text,when we are excute the sp_spaceused without any parameters, it will take defult parameter as null and refurn the current database size and details about that database

How to get all table size and other details

In this time we have to use our custom procedure to do this, becuase there is no inbuilt proc to get this details in sql server.how we can do this, let create a procedure and get all tables name from the database and fetch into cursor.

CREATE PROCEDURE spCodeGainSizeUtil
AS
DECLARE @TableName VARCHAR(100)
DECLARE dataCursor CURSOR
FOR
select [name]
from dbo.sysobjects
where OBJECTPROPERTY(id, N’IsUserTable’) = 1
FOR READ ONLY

CREATE TABLE #SizeTable
(
tableName varchar(100),
numberofRows varchar(100),
reservedSize varchar(50),
dataSize varchar(50),
indexSize varchar(50),
unusedSize varchar(50)
)

–Open the cursor
OPEN dataCursor

–Get the first table name from the cursor
FETCH NEXT FROM dataCursor INTO @TableName

–Loop until the cursor was not able to fetch
WHILE (@@Fetch_Status >= 0)
BEGIN

INSERT #SizeTable
EXEC sp_spaceused @TableName
FETCH NEXT FROM dataCursor INTO @TableName
END
CLOSE dataCursor
DEALLOCATE dataCursor
SELECT * FROM #SizeTable
DROP TABLE #SizeTable

GO
Enjoy in .net World!!!

Convert DataSet To String In C#.Net


private string GetTemplate()
{
string sReturnData = string.Empty;
try
{

string connectionString = “Provider=Microsoft.Jet.OleDb.4.0; data source=c:\\YRF.XLS; Extended Properties=Excel 8.0;”;
string selectString = “SELECT * FROM [new$]”;

System.Data.OleDb.OleDbCommand myCommand = new System.Data.OleDb.OleDbCommand();
System.Data.OleDb.OleDbDataAdapter adp = new System.Data.OleDb.OleDbDataAdapter(selectString,connectionString);
DataSet ds=new DataSet();
adp.Fill(ds);
System.Data.OleDb.OleDbConnection con = new System.Data.OleDb.OleDbConnection(connectionString);
System.Data.OleDb.OleDbCommand cmd = new System.Data.OleDb.OleDbCommand(selectString, con);

con.Open();
System.Data.OleDb.OleDbDataReader theData = cmd.ExecuteReader();

Int32 i = 0;
String str = “”;
System.Data.DataTable dt = new System.Data.DataTable();
dt = ds.Tables[0];
str += “”;
while (i < dt.Rows.Count)
{
str += "” + dt.Rows[i][0].ToString() + “” + “” + dt.Rows[i][1].ToString() + “” + “” + dt.Rows[i][2].ToString() + “” + “” + dt.Rows[i][3].ToString() + “” + “” + dt.Rows[i][4].ToString() + “” + “” + dt.Rows[i][5].ToString() + “” + “” + dt.Rows[i][6].ToString() + “” + “” + dt.Rows[i][7].ToString() + “” + “” + dt.Rows[i][8].ToString() + “” + “” + dt.Rows[i][9].ToString() + “”;
sReturnData += str;
i++;
}

}
catch (Exception ex)
{
lblError.Text = ex.Message;
sReturnData = “No Value”;
}

sReturnData += “”;
return sReturnData;
}