sqlexception was caught in c#and sqlserver running code

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • skumar11523
    New Member
    • Sep 2014
    • 2

    sqlexception was caught in c#and sqlserver running code

    Code:
    private void button1_Click(object sender, EventArgs e)
            {
                try
                {
                    SqlConnection sc = new SqlConnection(@"Data Source=KALAS-PC\SQLEXPRESS;Initial Catalog=master;Integrated Security=True");
                    sc.Open();
                    using (sc)
                    {
                        // FILEDOWNLOADED();
    
                        SqlCommand cmd = new SqlCommand(@" Bulk insert csvFile from 'D:\cm02SEP2014bhav.csv' with
                                          (
                                         
                                          FIELDTERMINATOR =',',
                                          ROWTERMINATOR ='\n'
                                          )", sc);
                        cmd.ExecuteNonQuery();
                        sc.Close();
    
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error");
                }
    i got this error...
    Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 1, column 3 (OPEN).
    The bulk load failed. The column is too long in the data file for row 1, column 13. Verify that the field terminator and row terminator are specified correctly.
    The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.
    Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".pl s help me
    Last edited by Rabbit; Sep 3 '14, 09:11 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
Working...