ERROR Error: 17300, Severity: 16, State: 1. (Params:). The error is printed in terse mode because there was error during formatting. Tracing, ETW, notifications etc are skipped.

Posted on 2008-02-01
Medium Priority
Last Modified: 2010-04-21
Hi Guys
Microsoft SQL 2005
VB.Net 2003
I have written a vb.net project which runs every 2 minutes as a scheduled task.

After a few days I receive this error Error: 17300, Severity: 16, State: 1. (Params:). The error is printed in terse mode because there was error during formatting. Tracing, ETW, notifications etc are skipped.

No one can access anything on SQL 2005. I have to restart the SQL Service.

I think it might be the code not closing database connections correctly.

This only occured since I inserted error trap code.

The code is below

I think this code is causing the stress and no where else.
That's because the code   sql = "Select * from Activation where Activated is null"
            OBJSQLdbcommand = New OleDb.OleDbCommand(sql, objConn)
            objdatareader = OBJSQLdbcommand.ExecuteReader
will not be null as there is nothing to activate yet.

Private Sub CheckLicenseKeyValidation()


        Dim strConnectionString As String = "Provider=sqloledb;Data Source=DSVR003226;Initial Catalog=Test;User Id=MASTER;Password=test;"
        Dim objConn As New System.Data.OleDb.OleDbConnection(strConnectionString)
        Dim objConn1 As New System.Data.OleDb.OleDbConnection(strConnectionString)
        Dim objConn2 As New System.Data.OleDb.OleDbConnection(strConnectionString)

        Dim objdatareader As OleDb.OleDbDataReader
        Dim objdatareader1 As OleDb.OleDbDataReader
        Dim objdatareader2 As OleDb.OleDbDataReader
        Dim objdatareader3 As OleDb.OleDbDataReader
        Dim objdatareader4 As OleDb.OleDbDataReader

        Dim OBJSQLdbcommand As New System.Data.OleDb.OleDbCommand
        Dim OBJSQLdbcommand1 As New System.Data.OleDb.OleDbCommand
        Dim OBJSQLdbcommand2 As New System.Data.OleDb.OleDbCommand
        Dim OBJSQLdbcommand3 As New System.Data.OleDb.OleDbCommand
        Dim OBJSQLdbcommand4 As New System.Data.OleDb.OleDbCommand



            Dim sql As String
            Dim LicenceKey As String
            Dim Company As String
            Dim UserName As String
            Dim Email As String
            Dim Inform As String
            Dim Telephone As String
            Dim Mobile As String
            Dim Source As String
            Dim ProductCode As String
            Dim FirstName As String
            Dim LastName As String
            Dim Note As String

            Dim regSQL As String
            Dim regLicenceKey As String
            Dim regCompany As String
            Dim regUserName As String
            Dim regEmail As String
            Dim regInform As String
            Dim regTelephone As String
            Dim regMobile As String
            Dim regSource As String
            Dim regProductCode As String
            Dim regFirstName As String
            Dim regLastName As String
            Dim regNote As String
            Dim sqlProcess As String

            sql = "Select * from Activation where Activated is null"
            OBJSQLdbcommand = New OleDb.OleDbCommand(sql, objConn)
            objdatareader = OBJSQLdbcommand.ExecuteReader

            Do While objdatareader.Read()
                If objdatareader.IsDBNull(0) Then
                    LicenceKey = ""

                    LicenceKey = objdatareader.GetValue(0)
                End If

                If objdatareader.IsDBNull(1) Then
                    Company = ""

                    Company = objdatareader.GetValue(1)
                End If

                If objdatareader.IsDBNull(2) Then
                    FirstName = ""

                    FirstName = objdatareader.GetValue(2)
                End If

                If objdatareader.IsDBNull(3) Then
                    LastName = ""

                    LastName = objdatareader.GetValue(3)
                End If

                If objdatareader.IsDBNull(4) Then
                    Email = ""

                    Email = objdatareader.GetValue(4)
                End If

                If objdatareader.IsDBNull(5) Then
                    Inform = ""

                    Inform = objdatareader.GetValue(5)
                End If

                If objdatareader.IsDBNull(6) Then
                    Telephone = ""

                    Telephone = objdatareader.GetValue(6)
                End If

                If objdatareader.IsDBNull(7) Then
                    Mobile = ""

                    Mobile = objdatareader.GetValue(7)
                End If

                If objdatareader.IsDBNull(8) Then
                    Source = ""

                    Source = objdatareader.GetValue(8)
                End If

                If objdatareader.IsDBNull(9) Then
                    ProductCode = ""

                    ProductCode = objdatareader.GetValue(9)
                End If

                If objdatareader.IsDBNull(11) Then
                    Note = ""

                    Note = objdatareader.GetValue(11)
                End If

                UserName = FirstName & " " & LastName

                'Check if License key matches in EIB_Table1_Customer
                Dim sql2 As String
                Dim ActivationLicense As String
                Dim ActivationCompany As String

                sql2 = "Select Distinct License_Key,Company_Name from EIB_Table1_Customer where License_Key = '" & LicenceKey & "'"
                OBJSQLdbcommand1 = New OleDb.OleDbCommand(sql2, objConn1)
                objdatareader1 = OBJSQLdbcommand1.ExecuteReader
                Do While objdatareader1.Read()
                    If objdatareader1.IsDBNull(0) Then
                        ActivationLicense = ""

                        ActivationLicense = objdatareader1.GetValue(0)
                    End If

                    If objdatareader1.IsDBNull(1) Then
                        ActivationCompany = ""

                        ActivationCompany = objdatareader1.GetValue(1)
                    End If

                    InsertActivationFields(ActivationLicense, ActivationCompany, UserName, Email, Inform, Telephone, Mobile, Source, ProductCode, "Yes", Note)
                    GenerateLicenceKey(ProductCode, Source, ActivationCompany, FirstName, LastName, Email, ActivationLicense)

                'If objdatareader1.RecordsAffected = 0 Then

                sqlProcess = "Select Top 1 License_Key from EIB_Table2_Registration where License_Key = '" & LicenceKey & "' order by Date_Registered desc"
                OBJSQLdbcommand4 = New OleDb.OleDbCommand(sqlProcess, objConn2)
                objdatareader4 = OBJSQLdbcommand4.ExecuteReader
                Do While objdatareader4.Read()

                    If objdatareader4.IsDBNull(0) Then
                        ActivationLicense = ""

                        ActivationLicense = objdatareader4.GetValue(0)
                    End If

                    InsertRegFields(ActivationLicense, Company, UserName, Email, Inform, Telephone, Mobile, Source, ProductCode, "Yes", Note)
                    RegistrationDetails(LicenceKey, Company)
                    GenerateLicenceKey(ProductCode, Source, Company, FirstName, LastName, Email, ActivationLicense)
                'End If

                If objdatareader4.RecordsAffected = 0 And objdatareader1.RecordsAffected = 0 Then
                    AddInvalidLicenceCustomer(LicenceKey, Company, UserName, Email, Inform, Telephone, Mobile, Source, ProductCode, "Yes", Note)
                    SendInvalidLicencemail(Company, UserName, LicenceKey, Email)
                End If

                'Close Form if nothing to Activate

                If LicenceKey = "" Then

                End If


        Catch exc As Exception
            ' MsgBox("Error: " & exc.Message)
            Send_Genlicense_System_email("Error: " & exc.Message)


            'If Not dr Is Nothing Then dr.Close()
            If Not objdatareader Is Nothing Then


            End If

            If Not objdatareader1 Is Nothing Then

            End If

            If Not objdatareader2 Is Nothing Then


            End If

            If Not objdatareader3 Is Nothing Then

            End If

            If Not objdatareader4 Is Nothing Then


            End If

            If Not objConn Is Nothing Then
            End If

            If Not objConn1 Is Nothing Then
            End If

            If Not objConn2 Is Nothing Then
            End If


        End Try

    End Sub

Question by:Shezad Ahmed
  • 2
  • 2
LVL 35

Expert Comment

by:David Todd
ID: 20800518

Make sure that an operator is set up in SQL Agent to get these alerts as well.

Check the SQL error log. In Enterprise Manager, DatabaseServerName | Management | SQL Server Logs

It is likely that this is a disk full, or database full or log full - very likely to be tempdb log file because rebooting will recreate an tempdb log file(s).

Your code appears to be properly closing your database connections after they are used.

What I'm saying above is first we need to find out more about your error.


Author Comment

by:Shezad Ahmed
ID: 20801810
Hi David

Thanks for reply.

I have checked log and the error below occurs hell of a lot.
Date            1/29/2008 1:52:11 AM
Log            SQL Server (Archive #1 - 2/1/2008 4:52:00 PM)

Source            Logon

Login failed for user 'sa'. [CLIENT:]

Also I get this message:    Date            2/1/2008 4:48:14 PM
Log            SQL Server (Archive #1 - 2/1/2008 4:52:00 PM)

Source            spid52

There is insufficient system memory to run this query.

I have just over 1000000 records in error log file. Most of them are the SA login failure. Is that right, Is this what  is writing to the temp.db.

LVL 75

Expert Comment

by:Anthony Perkins
ID: 20805591
You don't by any chance have your SQL Server outside the firewall do you? Please say no.
LVL 35

Accepted Solution

David Todd earned 1500 total points
ID: 20809992

To expand on what AC is saying: It looks like your SQL Server is outside your firewall, running on a default instance instead of a named instance, and someone is trying to hack into SQL - hence the SA login messages. Maybe not tempdb filling up the drive, but rather the error logs doing so. Rebooting will cause SQL to restart and cycle the error log, and so recover some disk space.

Things to do:
Make sure that there is some sort of firewall between the internet and your SQL server.
Get a job to run sp_cycle_errorlog once a day, which will keep the size of the file down.
Investigate how to reduce the number of error-logs that SQL holds. iirc it is 6.


Author Closing Comment

by:Shezad Ahmed
ID: 31427215
Thanks. I showed the IT manager the error log and he is looking into it. In a way I am glad. I thought it was my code.

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

598 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question