hi here is my code
protected void Page_Load(object sender, EventArgs e)
{
DataTable data = RetrieveSourceData();
CopyData(data);
}
public static DataTable RetrieveSourceData()
{
//connection string changes depending on the operation
//system you are running
string sourceConnString = @"Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=C:\Documents and Settings\Administrator\Desktop\;
Extended Properties=text;";
DataTable sourceData = new DataTable();
using (OleDbConnection conn =
new OleDbConnection(sourceConnString))
{
conn.Open();
// Get the data from the source table as a SqlDataReader.
OleDbCommand command = new OleDbCommand(
@"SELECT * from Products.txt", conn);
OleDbDataAdapter adapter = new OleDbDataAdapter(command);
adapter.Fill(sourceData);
conn.Close();
}
return sourceData;
}
public static void CopyData(DataTable sourceData)
{
string destConnString = @"Password=sdfdx;Persist Security
Info=True;User ID=xyz;Initial Catalog=dsfdx;Data
Source=1.27.1.01";
// Set up the bulk copy object.
using (SqlBulkCopy bulkCopy =
new SqlBulkCopy(destConnString))
{
bulkCopy.DestinationTableName = "dbo.tblProduct";
// Guarantee that columns are mapped correctly by
// defining the column mappings for the order.
bulkCopy.ColumnMappings.Add("Name", "Name");
bulkCopy.ColumnMappings.Add("ProductNumber", "ProductNumber");
bulkCopy.ColumnMappings.Add("Price", "ListPrice");
// Write from the source to the destination.
bulkCopy.WriteToServer(sourceData);
}
}
please help me
i need above code should be in tab delimeted not like this " ", " ",
thank you
can you Please modified above source code and let me know thanks every body