Click here to Skip to main content
15,891,184 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionChange text in a Messagebox button Pin
Ratheesh_v16-Jun-09 1:22
Ratheesh_v16-Jun-09 1:22 
AnswerRe: Change text in a Messagebox button Pin
Manas Bhardwaj16-Jun-09 2:11
professionalManas Bhardwaj16-Jun-09 2:11 
GeneralRe: Change text in a Messagebox button Pin
Baran M16-Jun-09 2:45
Baran M16-Jun-09 2:45 
QuestionProblem when creating email with In-memory attachment Pin
ipsario16-Jun-09 0:56
ipsario16-Jun-09 0:56 
Questiondata set break through loop in vb.net Pin
prabhat kumar mokama16-Jun-09 0:50
prabhat kumar mokama16-Jun-09 0:50 
AnswerRe: data set break through loop in vb.net Pin
Christian Graus16-Jun-09 16:28
protectorChristian Graus16-Jun-09 16:28 
AnswerRe: data set break through loop in vb.net Pin
souravghosh1816-Jun-09 22:07
souravghosh1816-Jun-09 22:07 
QuestionSQLBulkCopy & Adding values [modified] Pin
munklefish16-Jun-09 0:43
munklefish16-Jun-09 0:43 
Hi,

I am using the following code to take data from a csv file then adding it to an SQL database using SQLBulkCopy.

I need to add an additional column of data to each record transfered. This extra column is present in the SQL2005 database but not the CSV file, and relates to the users unique ID.

At present i have this:

    using (OleDbCommand dcmd = new OleDbCommand("SELECT * FROM " + strUPloadFile + "", dconn))
    {
        try
        {
            dconn.Open();

            using (OleDbDataReader dreader = dcmd.ExecuteReader())
            {

                // Bulk Copy to SQL Server
                using (SqlBulkCopy bulkCopy = new SqlBulkCopy(WebConfigurationManager.ConnectionStrings["######"].ConnectionString))
                {
                    //bulkCopy.ColumnMappings.Add("adds_ABMId", 45);
                    bulkCopy.ColumnMappings.Add("adds_Email", "E-mail Address");
                    bulkCopy.ColumnMappings.Add("adds_RecipientForename", "First Name");
                    bulkCopy.ColumnMappings.Add("adds_RecipientSurname", "Last Name");

                    bulkCopy.DestinationTableName = "tbl_AddressBookAddresses";

                    // Set the BatchSize.
                    bulkCopy.BatchSize = 500;
                    try
                    {//perform copy
                        bulkCopy.WriteToServer(dreader);
                    }
                    catch (Exception ex)
                    {//error
                        throw(ex);
                    }
                }

            }
        }
        finally
        {
            dconn.Close();
        }
    }
}


I could really do with some help on this.

Thanks guys!
Confused | :confused: Confused | :confused: Confused | :confused: Confused | :confused: Confused | :confused:

modified on Tuesday, June 16, 2009 6:49 AM

AnswerRe: SQLBulkCopy & Adding values Pin
himanshu256116-Jun-09 1:32
himanshu256116-Jun-09 1:32 
GeneralRe: SQLBulkCopy & Adding values Pin
munklefish16-Jun-09 1:50
munklefish16-Jun-09 1:50 
GeneralRe: SQLBulkCopy & Adding values Pin
himanshu256116-Jun-09 21:44
himanshu256116-Jun-09 21:44 
GeneralRe: SQLBulkCopy & Adding values Pin
munklefish16-Jun-09 23:40
munklefish16-Jun-09 23:40 
Questionwhat mean this write Pin
jason_mf16-Jun-09 0:09
jason_mf16-Jun-09 0:09 
AnswerRe: what mean this write Pin
pompeyboy216-Jun-09 0:38
pompeyboy216-Jun-09 0:38 
AnswerRe: what mean this write Pin
Baran M16-Jun-09 0:46
Baran M16-Jun-09 0:46 
Answerthe force strong in you is Pin
munklefish16-Jun-09 0:51
munklefish16-Jun-09 0:51 
AnswerRe: what mean this write Pin
Christian Graus16-Jun-09 18:32
protectorChristian Graus16-Jun-09 18:32 
QuestionFormat GridView Pin
yesu prakash15-Jun-09 23:48
yesu prakash15-Jun-09 23:48 
AnswerRe: Format GridView Pin
Baran M15-Jun-09 23:57
Baran M15-Jun-09 23:57 
AnswerRe: Format GridView Pin
Abhijit Jana16-Jun-09 0:02
professionalAbhijit Jana16-Jun-09 0:02 
AnswerRe: Format GridView Pin
Christian Graus16-Jun-09 0:04
protectorChristian Graus16-Jun-09 0:04 
QuestionGetting debug info Pin
Matt Cavanagh15-Jun-09 23:47
Matt Cavanagh15-Jun-09 23:47 
AnswerRe: Getting debug info Pin
Christian Graus16-Jun-09 0:02
protectorChristian Graus16-Jun-09 0:02 
GeneralRe: Getting debug info Pin
Matt Cavanagh16-Jun-09 0:11
Matt Cavanagh16-Jun-09 0:11 
AnswerRe: Getting debug info Pin
Baran M16-Jun-09 0:26
Baran M16-Jun-09 0:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.