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)
-   -   Open for help (http://p2p.wrox.com/showthread.php?t=124)

JonathanC June 4th, 2003 12:58 PM

Open for help
 
Hi All

Just to let you know that any questions posted here will be looked at :)

Hope you all enjoy the book



Jonathan Crossland
http://www.jonathancrossland.com

JovenaL June 14th, 2003 11:58 AM

I just finished doing the Try It Out - DataSet Examples in Chapter 16, and I am getting this error. I searched everywhere to see if anyone else in the world got this error, and I found a handful, so i figured, why not ask the authors for help :)

Here is the error

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

Additional information: System error.
"

When I Debug, It highlights this line:
 'Fill the dataset object with data...
        myDataAdapter.Fill(myDataSet, "authors")

Any help will be very much appreciated, please!

-Jovenal

JovenaL June 14th, 2003 11:59 AM

Whoops, I copied the wrong line of code that was giving me the error.

Here is the line that gets highlighted:

        'Now execute the command...
        myDataAdapter.SelectCommand.ExecuteNonQuery()

Sorry for the confusion.

JonathanC June 15th, 2003 11:21 PM

Hi JovenaL

This sounds like your SQL Select statement is incorrect.
The error you get likely occurs because the name of a table or field
is incorrect.
I have pasted the code from my version of the code. Look for the difference between yours and the code below.


'Start ................

  objDataAdapter.SelectCommand.CommandText = _
            "SELECT au_lname, au_fname, 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"
        objDataAdapter.SelectCommand.CommandType = CommandType.Text


'end ..............

I think its very likely that it is an error caused by a typo.

Please Let me know if this is the case.




Quote:

quote:Originally posted by JovenaL
 Whoops, I copied the wrong line of code that was giving me the error.

Here is the line that gets highlighted:

        'Now execute the command...
        myDataAdapter.SelectCommand.ExecuteNonQuery()

Sorry for the confusion.
Jonathan Crossland
http://www.jonathancrossland.com

JovenaL June 16th, 2003 12:12 PM

Doh.....i forgot an underscore hahah
THanks for the quick reply...

JovenaL June 16th, 2003 06:19 PM

question.
I need to make a function that deletes a row from an existing SQL Server 2000 Database.
I know I need to implement an SQL DataAdapter, as well as New Dataset.
My syntax for the SQL is correct, but I am getting the same error I got with my first question.

Error on this line
myDataAdapter.SelectCommand.ExecuteNonQuery()

Please help!

JonathanC June 19th, 2003 04:48 AM


If you have SQL tools, it may be helpful to write your sql in Query Analyzer. Then you will be sure that the statement works.

Then when you put the statement into your code, you will know whether the error is in the syntax of your SQL or in your code.

I suspect, that you have another tpyo :)
Assuming of course that the code is right.

After checking your syntax, if you are still getting the error, post the bit of source code up here so that I can see it. It will help in trying to help you get round this problem.




Jonathan Crossland
http://www.jonathancrossland.com


All times are GMT -4. The time now is 06:49 PM.

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