Bug in .Net related to variables

  • Thread starter Thread starter edb
  • Start date Start date
E

edb

Hi all,
i have posted this in another message board and
desparately need help :).

Here is a piece of my code. Please keep in mind my first
if-then code is strictly for validation. Once it has been
validated, I create this variable and gather them together
into an insert if-then statement. See below ...

'Declare Variables
'Dim ClientCountriesInfo as Integer

'Countries Validate
If (LstCountries.SelectedItem.Value = "Select a Country")
Then
If (ValCountry = "") Then
LblErrMain.Visible = True
LblErr6.Visible = True
Else
LblErrMain.Visible = False
LblErr6.Visible = False
'Create a variable to manage single or multiple posts to
SQL
'ClientCountriesInfo = 1
Dim ClientCountriesInfo As Integer = 1
End If
Else
LblErrMain.Visible = False
LblErr6.Visible = False
End If

'************************** DATA POST PROCESS
************************


If ClientCustInfo + ClientProdAreaInfo +
ClientProgDescInfo + ClientProductInfo +
ClientPlatformInfo + ClientCountriesInfo = 6 Then
'Post info to table and post new ID to Master Table
Dim strMainTblCnn As String
Dim sp_name As String
Dim comm As New SqlCommand
' The Connection string
strMainTblCnn = "DATABASE=POTATOS;UID=All;PWD=Rotten"
Dim conn As New SqlConnection(strMainTblCnn)
Dim ds As New DataSet
Dim DataAdapter As New SqlDataAdapter(comm)


Please help :)
thank you,
edb
 
What value do you get when you step through the debugger and add all of
those values. In your other post, you were testing if all of those
additions equalled "6" which is a string and it would normally yell at you
unless you have Option Strict Off (which should be included as a crime
against humanity ;-) ).

If you are falling through the if, I think it's b/c you are referring to it
as a string as indicated in another post b/c I used the same code and it
works fine.

Set a BreakPoint there and see what it's evaluating to.

HTH,

Bill
 
DATABASE=POTATOS
Is Dan Quayle your new DBA?

You are only declaring "ClientCountriesInfo" if ValCountry <> "" but
the code that uses it thereafter has no such restriction so it is
possible that it will be equal to Nothing. You need to add a check
for this case?

Hope this helps,
Duncan
 
Back
Top