Display Data In Datagrid - Error
-
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. -
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.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 -
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, 2008Below is the query SELECT AccountNum, LastName, FirstName, PolicyNumber, Premium FROM INSURE_TABLE This is query in the Data Adapter Configuration Wizard.
-
Below is the query SELECT AccountNum, LastName, FirstName, PolicyNumber, Premium FROM INSURE_TABLE This is query in the Data Adapter Configuration Wizard.
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 -
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, 2008Which other code are you requesting? The only code i have is the one in the Form_Load with reads:
jesSqlDataAdapter.Fill(jesDataSet1)
orjesSqlDataAdapter.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.