Results 1 to 6 of 6

Thread: SQLException error on Fill Method [RESOLVED]

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2001
    Location
    Buffalo, NY
    Posts
    297

    SQLException error on Fill Method [RESOLVED]

    Hey Guys,

    I apologize for the vague question, but I'm getting a real generic 'SQLException' error on the Fill method of my SQLDataAdapter object. I had this working maybe a month ago, but I haven't worked with it since then.

    Any ideas what causes such a generic error? I get five of them before the program shuts down.

    Thanks!

    --Ben
    Last edited by BenFinkel; Feb 3rd, 2004 at 12:03 PM.

  2. #2
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950
    I'd guess something's wrong with your SQL or code that uses it. Post some code use a try/catch block to get the exception message or tostring. msgbox your SQL before it executes, etc.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2001
    Location
    Buffalo, NY
    Posts
    297
    I can tell you my SQL code without even looking at it:

    "vwQuoteReport"

    It's just a view in the SQL Database.

    --Ben

  4. #4
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950
    Ok, but how do you call it? still need some code. And probably someone smarter than me.

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2001
    Location
    Buffalo, NY
    Posts
    297
    My Code:

    Code:
            Dim dsTemp As New M3DataSource()
            Dim rsRpts As ADODB.Recordset
    
            Dim strTableName As String
    
            Dim dsQuote As DataSet
            Dim sdcQuote As SqlClient.SqlConnection
            Dim sdaQuote As SqlClient.SqlDataAdapter
            Dim strSQL As String
    
            'First, get the report info from the table
            strSQL = "SELECT tblReports.* FROM tblReports " & _
                " WHERE [chrRptName] = '" & strName & "'"
            dsTemp.Connect()
            dsTemp.GetRecordSet(rsRpts, strSQL)
            If rsRpts.EOF Or rsRpts.BOF Then
                Exit Function
            End If
    
            strSQL = rsRpts.Fields("chrRptSQL").Value & " " & strWhere
            strTableName = rsRpts.Fields("chrRptTableName").Value
            dsTemp.Close()
    
            sdcQuote = New SqlClient.SqlConnection(gstrSDCString)
            sdaQuote = New SqlClient.SqlDataAdapter(strSQL, sdcQuote)
            dsQuote = New DataSet()
    
            sdaQuote.Fill(dsQuote, strTableName)
    Errors occur on the last line. strTableName = "vwrptQuote" which is definatley a view in my database.

    Thanks!

    --Ben

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2001
    Location
    Buffalo, NY
    Posts
    297
    Nevermind, I'm an Ass!

    I changed my Server name and never updated the connection string. I'm such an idiot...

    Thanks for the help!

    --Ben

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width