473,379 Members | 1,491 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,379 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 1174
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.