[RESOLVED] Load Data From Sql Server
I have developed an application in VB.NET and a database in MS SQL SERVER2000.I have defined corresponding controls(fields) on the form and I want to retrieve and display records on those controls from SQL Server database. I have defined parameters for SqlDataAdapter,SqlConnect as well as an appropriate data set accordingly.But my concern here is I can not retrieve/Load those records from the database using On-Click event of Fill method ie SqlDataAdapter1.Fill(dataset1).In which case am getting an error message like "An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll
Additional information: System error."
But still I can preview the records through the SqlDataAdapter!!!!
OLE DB provider for SQL Server was also set correctly.
Is there anything should be taken under consideration in SQL SERVER connection setups???since the same VB.NET form worked fine for MS Access database...
I am really stuck ....please can you help???
Re: Load Data From Sql Server
Are you using a DataGridView? I have an idea of what you are doing and I am not sure if this has bearing, but in the Click event of the button maybe att eh top of the sub you should set the Datagridview datasource to nothing then set it to the dataset at the end. This only applies if you are using a DataGridView though.
Just thinking out loud. :)
Re: Load Data From Sql Server
Why don't you use sql in namespace system.data.sqlclient? 'cause I think it's easier than using OLEDB. Just check this out. Or send me the code. I'll try to figure out. Have nice day.
Re: Load Data From Sql Server
Quote:
Originally Posted by tacoman667
Are you using a DataGridView? I have an idea of what you are doing and I am not sure if this has bearing, but in the Click event of the button maybe att eh top of the sub you should set the Datagridview datasource to nothing then set it to the dataset at the end. This only applies if you are using a DataGridView though.
Just thinking out loud. :)
tacoman. If you have read correctly in my post I have mentioned that I am actually using Forms with textboxes controls and not Data Gridview.Though Data Grid didnt workout either.
Re: Load Data From Sql Server
If you post some code, it would be better to help you out. This way everyone here will do a guessing work.
1 Attachment(s)
Re: Load Data From Sql Server
Quote:
Originally Posted by FatBear
Why don't you use sql in namespace system.data.sqlclient? 'cause I think it's easier than using OLEDB. Just check this out. Or send me the code. I'll try to figure out. Have nice day.
Hi Fat Bear Thanks for the response.Well since am a bit new into the VB.NET then could you explain a bit on the above suggestion of yours?? ie use of namespace system.data.sqlclient hows it configured out???I have attached my VB.NET form settings for your consideration.Can you advice me accordingly?
Thanks&rgds
ken
Re: Load Data From Sql Server
Theres not much of code written in your program. Although it runs perfectly on my system when I change the connection string and the DataBindings. Have you checked if the connection string and databinding properties are set correctly?
Re: Load Data From Sql Server
Quote:
Originally Posted by Shuja Ali
If you post some code, it would be better to help you out. This way everyone here will do a guessing work.
Hello Shuja.
I have posted some setups and code for your consideration..just checkout my previous post
Re: Load Data From Sql Server
Quote:
Originally Posted by kenone
Hello Shuja.
I have posted some setups and code for your consideration..just checkout my previous post
I posted my previous post only after looking at your code.
Re: Load Data From Sql Server
Quote:
Originally Posted by Shuja Ali
Theres not much of code written in your program. Although it runs perfectly on my system when I change the connection string and the DataBindings. Have you checked if the connection string and databinding properties are set correctly?
Connection string and data binding properties are fine.But still I cant display data on the form.However ,I could dipaly data through crystal report.
I am totally confused