HighTechTalks DotNet Forums  

sqlDataAdapter Error

Dotnet Academic General Discussions microsoft.public.dotnet.academic


Discuss sqlDataAdapter Error in the Dotnet Academic General Discussions forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
joseph micheli
 
Posts: n/a

Default sqlDataAdapter Error - 08-10-2005 , 08:36 PM






I have the following code attached to the click event of a button. It fails
on the line "da.Fill (ds, "Results") The error is below the code. Any
suggestions would be greatly appreciated. Thanks.

Dim cmd As SqlCommand = SqlConnection1.CreateCommand
cmd.CommandType = CommandType.Text
cmd.CommandText = txtQuery.Text
Dim da As SqlDataAdapter = New SqlDataAdapter
da.SelectCommand = cmd
Dim ds As DataSet = New DataSet
da.Fill(ds, "Results")
dgResults.DataSource = ds
dgResults.DataMember = "Results"

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

Additional information: System error.
--
Joe Micheli CPA, CMA, CFM, CPIM

Reply With Quote
  #2  
Old   
FPM
 
Posts: n/a

Default RE: sqlDataAdapter Error - 08-16-2005 , 03:46 PM






hi joseph,

I think that the first thing you should do is to enclose your
'da.Fill(ds,"Results")'-statement in a try-catch-block. In that way you can
catch the exception and examine it more closely. The exception should give
more insight on what is causing the error.

Frank.

"joseph micheli" wrote:

Quote:
I have the following code attached to the click event of a button. It fails
on the line "da.Fill (ds, "Results") The error is below the code. Any
suggestions would be greatly appreciated. Thanks.

Dim cmd As SqlCommand = SqlConnection1.CreateCommand
cmd.CommandType = CommandType.Text
cmd.CommandText = txtQuery.Text
Dim da As SqlDataAdapter = New SqlDataAdapter
da.SelectCommand = cmd
Dim ds As DataSet = New DataSet
da.Fill(ds, "Results")
dgResults.DataSource = ds
dgResults.DataMember = "Results"

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

Additional information: System error.
--
Joe Micheli CPA, CMA, CFM, CPIM

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.