Subject: Parameterized SQLDataAdapter
Posted By: boyshey Post Date: 4/13/2006 4:30:39 PM
Hey,

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
DaAll.Fill(DsAll)
Reply By: boyshey Reply Date: 4/14/2006 7:08:18 AM
AAAAAAAAAAARGHHHHHHHHHHHH!!!

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...

ciao

Go to topic 42931

Return to index page 314
Return to index page 313
Return to index page 312
Return to index page 311
Return to index page 310
Return to index page 309
Return to index page 308
Return to index page 307
Return to index page 306
Return to index page 305