Archive for 2012
Client side validation of File type before you upload a file
To validate a file type or say file extension on client side before you upload a file can be performed by just putting a Regular Expression Validator. Here, i have provided one example to allow uploading only .jpg or .gif files. All you need is a FileUpload control and a Regular Expression Validator to check file type.
<asp:FileUpload ID=”FileUpload1″ runat=”server” />
<asp:RegularExpressionValidator ID=”RegularExpressionValidator1″ runat=”server” ControlToValidate=”FileUpload1″ Display=”Dynamic” ErrorMessage=”Upload a valid file” ValidationExpression=”^.+(.jpg|.JPG|.gif|.GIF)$”></asp:RegularExpressionValidator>
If you want to put your own file type validation then just replace “.jpg,.JPG,.gif,.GIF” text, and you can add more file types by adding “|” (pipe) sign and your own file type to validate.
ConnectionStrings in ASP.NET
<connectionStrings>
<add name="con" connectionString="Data Source=SERVER NAME;Initial Catalog=datamining;Persist Security Info=True;User ID=sa;Password=root"/>
</connectionStrings>
<appSettings>
<add key="connection" value="server=SERVER NAME;user id=sa;password=root;initial catalog=Hindustan;pooling=false"/>
</appSettings>
Import CSV File into MYSQL Query Browser
Import CSV File into MYSQL Query Browser :
Simple Query:
LOAD DATA LOCAL INFILE 'E:/123.csv' INTO TABLE documentupload FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
After that i used “select * from test_table”. The data are displayed
Simple Query:
LOAD DATA LOCAL INFILE 'E:/123.csv' INTO TABLE documentupload FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
After that i used “select * from test_table”. The data are displayed
Thursday, November 1, 2012
Posted by ஆனந்த் சதாசிவம்