p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 (http://p2p.wrox.com/forumdisplay.php?f=34)
-   -   problem with binding example (chap 16) (http://p2p.wrox.com/showthread.php?t=9227)

cr1sty February 11th, 2004 06:19 AM

problem with binding example (chap 16)
 
i have try to follow excatly the same coding with the book, 4 binding simple control(pg 647) but i encounter this prob
when i run the program, there is an error

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

Additional information: System error.

the system show the error on this line
myadapter.Fill(myds, "authors")

can somebody tell me why?


Akuta February 12th, 2004 07:14 PM

I was having this issue for a while as well. It turned out that there was some sort of issue with the connection string (not SelectCommand, but the actual "myConnection's" string).

One thing that helped me find out what it was that was causing the issue was to get the source code for the book off of the Wrox site. I compared the two code samples (which had originally appeared the same to me, looking from screen to book). I noticed a single character that made all the difference. Might try that.


safzalahmed@yahoo.com June 17th, 2004 01:47 AM

Hi Akuta,

I amd facing the same problem. Can you please specify which single character solved your problem. This is because I do not get binding example from the wrox site. It only contains DataSet Example.

Can you send the code also.

Best Regards

Afzal


JerxDcs June 21st, 2004 07:32 PM

I am having the same exact problem.. and im looking at the book and the code from the wrox site and they both seem the same to me. plus even when i modify the the connection line to use my sa password the wrox code still doesnt work.

same exact error..

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

Additional information: System error.

Jonathan... you there buddy..??? can you please lend a hand on this one ??

thanks
Jer.


JonathanC June 22nd, 2004 08:46 AM

Hi All

When you recieve an error of SqlException it is always likely that there is a more specific error.
Wrap the code in the Form1_Load event with a

Try

'the existing code here
Catch exception As Exception
MessageBox.Show(exception.Message)
End Try

You will notice that a more beneficial message will popup for you.
I suspect that it is likely to be a connection string error.
Could you please verify that your connection string is correct by logging into your SQL database via Analyzer or through the VS.NET Server Explorer.


You can put up the detailed error on the board for me to see.
Then we can try to get it working for you.




Jonathan Crossland
http://www.jonathancrossland.com

JerxDcs June 22nd, 2004 03:29 PM

holy crap Jonathan you are the man.. thank you so much. first i found it was my connection string so i changed it back to what i first had it as

    Dim objconnection As SqlConnection = New _
        SqlConnection("server=NADA;integrated security=SSPI;initial catalog=pubs;")

then i found out it was a simple spelling error on my part that i didnt notice..

thank you so much. great book by the way. this chapter is helping me out so much.

Ciao
Jer.


frankychen04 July 4th, 2004 08:36 PM

where can I download this Binding Example code?


CathyM September 12th, 2005 03:14 PM

Hi,

I have the same problem with the binding example in Ch 16. When I use try..catch statements to catch the problem. I get the message, Line 1:incorrect syntax near '.'. I think it has something to do with the titles table, but I don't see why, I checked the table in SQLServer and the fields and data is intact.

Any help appreciated.

Cathy

CathyM September 12th, 2005 03:16 PM

Sorry, forgot to add my SQL statement

Dim myAdapter As SqlDataAdapter = New SqlDataAdapter( _
    "SELECT authors.au_id,au_lname, au_fname " & _
        "titles.title_id, title, price " & _
        "FROM authors " & _
        "JOIN titleauthor ON authors.au_id = titleauthor.au_id" & _
        "JOIN titles on titleauthor.title_id = titles.title_id " & _
        "ORDER BY au_lname, au_fname", myConnection)


All times are GMT -4. The time now is 04:28 AM.

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