Posted on July 10, 2008 by Siemen
Here I will show how to Import data from csv file to sql database or any other database.
//This is the connection string to connect to your csv file
string strConString = “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\; Extended Properties=\”Text;HDR=YES;\””;
// open connection
OleDbConnection oCon = new OleDbConnection(strConString);
oCon.Open();
// fill data set
string strSql = “SELECT * FROM csvfile.csv”; //csvfile should be present in c:
OleDbDataAdapter [...]
Filed under: asp.net c#, csv, sql | Tagged: c#, csv, csv to sql, dot net, get csv, import csv file to database, import csv to sql, read csv file, sql | 6 Comments »
Posted on May 7, 2008 by Siemen
This post shows you how to return XmlDataDocument from the database.
This helps you to fetch the xml data created in sql and use in asp.net.
If you are familiar how to get xml data from sql then this post helps you to fetch the xml data in XmlDataDocument.
//Code Starts Here
// http://helpindotnet.blogspot.com/
// http://helpindotnet.wordpress.com
public XmlDataDocument getauditnames(string prefixText, int [...]
Filed under: asp.net c#, sql, xml | Tagged: get xml from sql, sql from xml, xml, xml from database, xmldatadocument | Leave a Comment »
Posted on May 6, 2008 by Siemen
<span style=”font-weight:bold;”>Here I will show you the easiest way to compress and Decompress (Gzip) a file using Asp.net with c#.
You can compress any file with this method.</span>
//Code Starts here
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.IO.Compression;
/*
* http://helpindotnet.blogspot.com/
*/
namespace ConsoleApplication1
{
class GZipTest
{
private const int buffer_size = 100;
public static int ReadAllBytesFromStream(Stream stream, byte[] buffer)
{
// Use this method is used to read [...]
Filed under: asp.net c# | Tagged: compress a file, compress file, gzip, GZip Compress Decompress | Leave a Comment »
Posted on May 6, 2008 by Siemen
<span style=”font-weight:bold;”>Send Mail Messages Using System.Net.Mail namespace (new in .net Framework Version 2.0) which provides classes that enable you to easily create and transmit e-mail messages.</span>
Asp.net c#:
// Create a MailMessage object
MailMessage mm = new MailMessage();
// Define the sender and recipient
mm.From = new MailAddress(fromEmailAddress.Text, fromDisplayName.Text);
mm.To.Add(new MailAddress(toEmailAddress.Text, toDisplayName.Text));
// Define the subject and body
mm.Subject = subjectTextBox.Text;
mm.Body = bodyTextBox.Text;
mm.IsBodyHtml [...]
Filed under: asp.net c# | Tagged: asp.net send mail, c# send mail, mail using .net, MailMessage object, System.Net.Mail | 2 Comments »