Wrox Programmer Forums
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics 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 April 13th, 2006, 04:30 PM
Registered User
Join Date: Apr 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Parameterized SQLDataAdapter


I am having trouble with the following section of code. I get an "An unhandled exception of type 'System.Data.SqlClient.SqlException'.." error when i try to fill the dataset... Pls help... i'm going crazy..

I am using SQL Server 2000 (Country Char 20 & rDate Char 8)

Dim SQLCon As SqlConnection = New SqlConnection("workstation id=STD;packet size=4096;integrated security=SSPI;data source=STD;persist security info=False;initial catalog=RetroFit")

Dim DaAll As SqlDataAdapter = New SqlDataAdapter("SELECT AllID, Country, rDate, Account, Description, BookBal, Trans, LastDate, StopSt FROM [All] Where (All.Country = @Country) AND (All.rDate = @rDate)", SQLCon)
DaAll.SelectCommand.Parameters.Add("@Country", SqlDbType.VarChar, 20).Value = frmCountry
DaAll.SelectCommand.Parameters.Add("@rDate", SqlDbType.VarChar, 8).Value = xDate
Dim DsAll As DataSet = New DataSet
Old April 14th, 2006, 07:08 AM
Registered User
Join Date: Apr 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts


I found the problem...

The table name "All" is a registered name within the MS environment. It needed to be [All] in the SQL statement...


Similar Threads
Thread Thread Starter Forum Replies Last Post
sqldataadapter vgsgowrisankar C# 2005 7 April 23rd, 2008 04:32 PM
SqlDataAdapter DanRoche .NET Framework 1.x 3 August 20th, 2007 04:04 AM
SqlDataAdapter Issue Tom Wing VB.NET 2002/2003 Basics 2 February 6th, 2006 01:43 PM
sqlDataAdapter webguy@rocketmail.com ADO.NET 1 April 8th, 2004 12:28 AM

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