Wrox Programmer Forums
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 18th, 2009, 08:38 AM
Authorized User
 
Join Date: Dec 2006
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default Datagrid Display

I formally used ms access as my database.
When i needed to display a table information in my datagrid i used this code in the form_load sub
Code:
 asterdataset1.clear()
 asteroledbdataadapter.fill(asterdataset1)
However when i changed my database to ms sql this code does not work.
I have my imports system.data.sqlclient in place.
I have my datasets and adapters configured and code in form_load same;
Code:
 asterdataset2.clear()
 astersqldataadapter.fill(asterdataset2)
The error i get reads:
an unhandled exception of type 'system.data.sqlclient.sqlexception' occurred in system.data.dll
 
Old February 18th, 2009, 08:41 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Hi...

What if you do a try catch to get info about the error??

and maybe, maybe, the SQL you are using to get the data is failing?
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========
 
Old February 19th, 2009, 05:02 AM
Authorized User
 
Join Date: Dec 2006
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The error i get reads:
an unhandled exception of type 'system.data.sqlclient.sqlexception' occurred in system.data.dll
 
Old February 19th, 2009, 06:04 AM
Registered User
 
Join Date: Feb 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Hi,

But through MS access I am not able to ms access as my database. Showing error.

----------------------------
Database archiving
 
Old February 19th, 2009, 08:01 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

I will ask again. Does the query work in SQL server?
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========
 
Old February 19th, 2009, 11:44 AM
Authorized User
 
Join Date: Dec 2006
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am currently work with ms sql server and still geting the error above.
 
Old February 19th, 2009, 12:00 PM
Authorized User
 
Join Date: Dec 2006
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have followed the advice on a topic on this site.
Link is http://aspalliance.com/124_All_You_N...ONET_Part_12.4

I used
Code:
 
SqlDataAdapter1.Fill(MyDataSetName, "Table_Name")
In the form load of the datagrid and i still get the error:

An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll
Additional Information: System error

What can this error be since i have done exactly what the document in the link above says.
 
Old February 19th, 2009, 12:12 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

I will ask for the third time (since you are not answering my question). Does the query work inside SQL server?

Please show us your query.
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========
 
Old February 19th, 2009, 02:15 PM
Authorized User
 
Join Date: Dec 2006
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes this query works on the sql server.

Below is the query

SELECT AccountNum, LastName, FirstName, PolicyNumber, Premium
FROM INSURE_TABLE

This is the same query in the Data Adapter Configuration Wizard.
 
Old February 19th, 2009, 02:20 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Thanks, then could be a code issue.
Maybe you forget something when you translate the object to the sqlclient.. can you show us some code so we can see is something is wrong?? also, could you try to connect to something else in the database to see if it is really working?

The error is to generic to have an idea of what is happening.

If you bound the grid (just as a trial) do it connect correctly and fetch data from the database??
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
DataGrid Column Display degie C# 2005 0 May 28th, 2007 01:48 AM
Datagrid display Lovehead VB.NET 2002/2003 Basics 1 January 20th, 2007 05:12 PM
Display Image in Datagrid annie_stwg ASP.NET 1.0 and 1.1 Basics 2 March 15th, 2006 03:57 PM
Datagrid display deadrocker .NET Web Services 1 February 12th, 2005 07:04 AM
hierarchical display in datagrid aravwind General .NET 2 July 30th, 2004 03:12 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.