473,320 Members | 1,974 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Bug in .Net related to variables

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
Jul 21 '05 #1
2 1171
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
"edb" <m1**@dm2000.com> wrote in message
news:08****************************@phx.gbl...
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

Jul 21 '05 #2
> > 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
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

Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: opt_inf_env | last post by:
Hello, I have started to study sessions and as I understood it works in the following way: Let us consider two files first.php and second.php. By clicking on a link in the file first.php user...
5
by: Rob Ristroph | last post by:
Hi, It's pretty unhelpful to post "I have a huge piece of code that crashes in strange places, what's the problem?" but that's basically my problem and I really am at my wit's end. The piece...
10
by: david wolf | last post by:
The following pthread code cannot compile, I want to know why. Can somebody give me direction on this? if I replace the following line of code status1 = pthread_create(&threadID1, NULL, read,...
8
by: Gaijinco | last post by:
I have always indirectly know how RAM is used when a C++ program is run, but I wanted to be sure I got it right: First the OS copies the whole program to RAM. Every statement of the kind int x;...
14
by: ToddLMorgan | last post by:
Summary: How should multiple (related) projects be arranged (structured) and configured so that the following is possible: o Sharing common code (one of the projects would be a "common" project...
10
by: Schraalhans Keukenmeester | last post by:
I suspect the following problem IS hosting provider specific, but they haven't been able to help me out so far. Perhaps I am doing something wrong and someone is able to spot the issue... Here...
1
by: trs | last post by:
Hi, I am developing an application module in asp.net and the site is currently developed in asp.net. 1.How can i transfer my session variables or information from asp pages to aspx pages....
1
by: Itanium | last post by:
Hi all! I'm new to .NET Platform and got some simple questions about efficiency... To put you in situation, to say that I'm involved in the writing of a complex regex based lexer for use over...
7
by: Tom Davis | last post by:
I am having a problem where a long-running function will cause a memory leak / balloon for reasons I cannot figure out. Essentially, I loop through a directory of pickled files, load them, and run...
11
by: whirlwindkevin | last post by:
I saw a program source code in which a variable is defined in a header file and that header file is included in 2 different C files.When i compile and link the files no error is being thrown.How is...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.