Parameterized SQLDataAdapter
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)
|