Click here to Skip to main content
14,694,012 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My code below works very fine in visual studio but when I use it on my website (godaddy), no data is inserted into the database. I realised the datatable reads empty. please save my day

Using con As New SqlConnection(ConfigurationManager.ConnectionStrings("connection").ConnectionString)
                    con.Open()
                    Dim cmd As SqlCommand = con.CreateCommand()
                Using transaction As SqlTransaction = _
                  con.BeginTransaction()
 
                    Using bulkCopy As SqlBulkCopy = New _
                 
     SqlBulkCopy(con, _
                         SqlBulkCopyOptions.KeepIdentity, transaction)
                        bulkCopy.BatchSize = 10
                        bulkCopy.DestinationTableName = _
                         "trycsv" 
                        cmd.Connection = connection
                        cmd.Transaction = transaction
 
                        Try
						
                            bulkCopy.WriteToServer(reader)
							    cmd.CommandText = _"UPDATE trycsv  SET level = @level  where level =@updlevel"
							   cmd.Parameters.AddWithValue("@level", "1")
                              cmd.Parameters.AddWithValue("@updlevel", "O")
							  cmd.ExecuteNonQuery()
							
                            transaction.Commit()
                                
                        Catch ex As Exception
                            
                            transaction.Rollback()
 
                        Finally
                            con.Close()
                        End Try 
                    End Using 
                End Using 
            End Using
Posted
Updated 13-Dec-14 1:41am
v2

1 solution

works correct, was godaddy permision settings
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900