From Visual Studio 15, I am running an insert query to SQL Server. This is a Console Application. The application read from multiple files and enter near 200 000 records in a single run during which connection is closed and opened for any new folder of files so each folder provide more than (or less) a 50 000 entries. I have set myconn.CommandTimeout=0 So it would keep on running and SQL property Auto Close is set to off, both application and sql server are on same machine, It says
Db "my db name" log is not available
And then query stops please tell me how can I enter so many records without interruption. Please let me know if I have missed some information.
Original Error Output:
Unhandled Exception: System.Data.SqlClient.SqlException: The log for database 'paklaw' is not available. Check the event log for related error messages. Resolve any errors and restart the database.
A severe error occurred on the current command. The results, if any, should be discarded.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at filereadproj.Program.sqlfunc(SqlConnection conn, Int32 bi, String br, Int32 sI, String sV, Int32 s2I, String s2V, Int32 tsI, String tsV, String fn, String of, Boolean ke) in C:\Users\Saif-ul-Islam\Documents\Visual Studio 2015\Projects\filereadproj\filereadproj\Program.cs:line 730
at filereadproj.Program.Main(String[] args) in C:\Users\Saif-ul-Islam\Documents\Visual Studio 2015\Projects\filereadproj\filereadproj\Program.cs:line 139