Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Display Data In Datagrid - Error

Display Data In Datagrid - Error

Scheduled Pinned Locked Moved Visual Basic
databasehelp
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 3672257
    wrote on last edited by
    #1

    I am using MS SQL as my database. To display my data in a datagrid i used the SqlDataAdapter, SqlConnection and its DataSet to connect to my database. When i preview my data through the SqlDataAdapter its just fine. But this will not work for the datagrid. I used _jesSqlDataAdapter.Fill(jesDataSet1)_ or _jesSqlDataAdapter.Fill(jesDataSet1, "Table_Name")_ in the form/datagrid load sub. However i get an error: An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll Additional information:System error. Please help.

    D 1 Reply Last reply
    0
    • U User 3672257

      I am using MS SQL as my database. To display my data in a datagrid i used the SqlDataAdapter, SqlConnection and its DataSet to connect to my database. When i preview my data through the SqlDataAdapter its just fine. But this will not work for the datagrid. I used _jesSqlDataAdapter.Fill(jesDataSet1)_ or _jesSqlDataAdapter.Fill(jesDataSet1, "Table_Name")_ in the form/datagrid load sub. However i get an error: An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll Additional information:System error. Please help.

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      From the very limited information you provided, it looks like the SQL query you tried to run isn't valid, or how you setup the query to execute isn't correct.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007, 2008

      U 1 Reply Last reply
      0
      • D Dave Kreskowiak

        From the very limited information you provided, it looks like the SQL query you tried to run isn't valid, or how you setup the query to execute isn't correct.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007, 2008

        U Offline
        U Offline
        User 3672257
        wrote on last edited by
        #3

        Below is the query SELECT AccountNum, LastName, FirstName, PolicyNumber, Premium FROM INSURE_TABLE This is query in the Data Adapter Configuration Wizard.

        D 1 Reply Last reply
        0
        • U User 3672257

          Below is the query SELECT AccountNum, LastName, FirstName, PolicyNumber, Premium FROM INSURE_TABLE This is query in the Data Adapter Configuration Wizard.

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          OK. That leaves the code you have to setup and execute the query. Something isn't right, either from how you setup the connection, like connection string and SqlConnection objects, down to setting up the SqlDataAdapter. Without seeing that code, there isn't much we can tell you.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007, 2008

          U 1 Reply Last reply
          0
          • D Dave Kreskowiak

            OK. That leaves the code you have to setup and execute the query. Something isn't right, either from how you setup the connection, like connection string and SqlConnection objects, down to setting up the SqlDataAdapter. Without seeing that code, there isn't much we can tell you.

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007, 2008

            U Offline
            U Offline
            User 3672257
            wrote on last edited by
            #5

            Which other code are you requesting? The only code i have is the one in the Form_Load with reads: jesSqlDataAdapter.Fill(jesDataSet1) or jesSqlDataAdapter.Fill(jesDataSet1, "Table_Name") I used the data wizards to configure the dataadapter and dataset. I chose the Microsoft OLE DB Provider for SQL Server at the Data Link Properties.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups