I am trying to store a string into a string variable via the following code
however am receiving an error and cant figure out what i am doing wrong. Any
feedback is greatly appreciated.
Line 49: Private Sub Button1_Click(B yVal sender As System.Object, ByVal
e As System.EventArg s) Handles Button1.Click
Line 50:
Line 51: Dim strSQL As String = "INSERT INTO Investors
(FNAME,LNAME,EM AIL,ADDRESS1,AD DRESS2," & _
Line 52:
"CITY,STATE,ZIP ,PNUMBER,ANUMBE R,ATYPE,BESTTIM E,INT_PRICERANG E1," & _
Line 53:
"INT_PRICERANGE 2,INT_LOCATION, INT_WHEN,PRODUC TS_PURCHASED) VALUES ('" & _ 6 1156
Well, if your code terminates like this (line 53) it is no wonder you get an
error. By using "& _" the compiler will expect another line of code. Your
code suggests there actually exists a line 54, but somehow it fell out? Post
your line 54 onwards and I will try to help.
Tor Bådshaug
tor.badshaug [//at\\] bekk.no. Line 53: "INT_PRICERANGE 2,INT_LOCATION, INT_WHEN,PRODUC TS_PURCHASED) VALUES ('" & _
As always, get simple code working first.
Jeff
"Ryan Smith" <Ry*******@disc ussions.microso ft.com> wrote in message
news:AB******** *************** ***********@mic rosoft.com... I am trying to store a string into a string variable via the following
code however am receiving an error and cant figure out what i am doing wrong.
Any feedback is greatly appreciated.
Line 49: Private Sub Button1_Click(B yVal sender As System.Object,
ByVal e As System.EventArg s) Handles Button1.Click Line 50: Line 51: Dim strSQL As String = "INSERT INTO Investors (FNAME,LNAME,EM AIL,ADDRESS1,AD DRESS2," & _ Line 52: "CITY,STATE,ZIP ,PNUMBER,ANUMBE R,ATYPE,BESTTIM E,INT_PRICERANG E1," & _ Line 53: "INT_PRICERANGE 2,INT_LOCATION, INT_WHEN,PRODUC TS_PURCHASED) VALUES ('" & _
Here is all of the code:
Dim strSQL As String = "INSERT INTO Investors
(FNAME,LNAME,EM AIL,ADDRESS1,AD DRESS2," & _
"CITY,STATE,ZIP ,PNUMBER,ANUMBE R,ATYPE,BESTTIM E,INT_PRICERANG E1," & _
"INT_PRICERANGE 2,INT_LOCATION, INT_WHEN,PRODUC TS_PURCHASED) VALUES ('" & _
FNAME.Text & "','" & _
LNAME.Text & "','" & _
EMAIL.Text & "','" & _
ADDRESS.Text & "','" & _
ADDRESS1.Text & "','" & _
CITY.Text & "','" & _
dState.Selected Item.Text & "','" & _
ZIP.Text & "','" & _
PNUMBER.Text & "','" & _
ANUMBER.Text & "','" & _
AType.SelectedI tem.Text & "','" & _
BESTTIME.Select edItem.Text & "','" & _
INT_PRICERANGE1 .Text & "," & _
INT_PRICERANGE2 .Text & "," & _
INT_LOCATION.Te xt & "','" & _
INT_WHEN.Text & "','" & _
PRODUCTS.Text & "')"
"Tor BÃ¥dshaug" wrote: Well, if your code terminates like this (line 53) it is no wonder you get an error. By using "& _" the compiler will expect another line of code. Your code suggests there actually exists a line 54, but somehow it fell out? Post your line 54 onwards and I will try to help.
Tor BÃ¥dshaug tor.badshaug [//at\\] bekk.no.
Line 53: "INT_PRICERANGE 2,INT_LOCATION, INT_WHEN,PRODUC TS_PURCHASED) VALUES ('" & _
And what is the error message you get? Compile error or runtime error?
Tor Bådshaug
tor.badshaug [//at\\] bekk.no.
.... Here is all of the code:
The error says Server Error in '/WebApp' Application
Object reference not set to an instance of an object
Exception Details: System.NullRefe renceException: Object reference not set
to an instance of an object
It's like it has an issue with setting the string to the variable.... i'm
stumped!
"Ryan Smith" wrote: Here is all of the code:
Dim strSQL As String = "INSERT INTO Investors (FNAME,LNAME,EM AIL,ADDRESS1,AD DRESS2," & _
"CITY,STATE,ZIP ,PNUMBER,ANUMBE R,ATYPE,BESTTIM E,INT_PRICERANG E1," & _
"INT_PRICERANGE 2,INT_LOCATION, INT_WHEN,PRODUC TS_PURCHASED) VALUES ('" & _ FNAME.Text & "','" & _ LNAME.Text & "','" & _ EMAIL.Text & "','" & _ ADDRESS.Text & "','" & _ ADDRESS1.Text & "','" & _ CITY.Text & "','" & _ dState.Selected Item.Text & "','" & _ ZIP.Text & "','" & _ PNUMBER.Text & "','" & _ ANUMBER.Text & "','" & _ AType.SelectedI tem.Text & "','" & _ BESTTIME.Select edItem.Text & "','" & _ INT_PRICERANGE1 .Text & "," & _ INT_PRICERANGE2 .Text & "," & _ INT_LOCATION.Te xt & "','" & _ INT_WHEN.Text & "','" & _ PRODUCTS.Text & "')" "Tor BÃ¥dshaug" wrote:
Well, if your code terminates like this (line 53) it is no wonder you get an error. By using "& _" the compiler will expect another line of code. Your code suggests there actually exists a line 54, but somehow it fell out? Post your line 54 onwards and I will try to help.
Tor BÃ¥dshaug tor.badshaug [//at\\] bekk.no.
Line 53: "INT_PRICERANGE 2,INT_LOCATION, INT_WHEN,PRODUC TS_PURCHASED) VALUES ('" & _
If that is the code which threw the exception, and it is all one statement,
concatenating a bunch of strings together, then one of the references in the
code to an object must be a reference to an object that is null, Nothing, or
not initialized (the same meaning for all 3). Let's take it a step at a
time, so that next time you won't have to ask. First, you are concatenating
string literals, so that's not a problem. Second, you're adding in the Text
property of a number of form elements. As the Text property is always a
string, if only a blank string, that's not a problem either. Finally, you
are referencing the "SelectedIt em" property of several listboxes. As this
property is initialized to null (Nothing), unless something changed the
SelectedItem, the exception would be thrown there.
Chances are, you can fix this by setting the SelectedItem property when you
initialize the ListBoxes.
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
"Ryan Smith" <Ry*******@disc ussions.microso ft.com> wrote in message
news:E2******** *************** ***********@mic rosoft.com... The error says Server Error in '/WebApp' Application
Object reference not set to an instance of an object Exception Details: System.NullRefe renceException: Object reference not
set to an instance of an object
It's like it has an issue with setting the string to the variable.... i'm stumped!
"Ryan Smith" wrote:
Here is all of the code:
Dim strSQL As String = "INSERT INTO Investors (FNAME,LNAME,EM AIL,ADDRESS1,AD DRESS2," & _
"CITY,STATE,ZIP ,PNUMBER,ANUMBE R,ATYPE,BESTTIM E,INT_PRICERANG E1," & _
"INT_PRICERANGE 2,INT_LOCATION, INT_WHEN,PRODUC TS_PURCHASED) VALUES ('" &
_ FNAME.Text & "','" & _ LNAME.Text & "','" & _ EMAIL.Text & "','" & _ ADDRESS.Text & "','" & _ ADDRESS1.Text & "','" & _ CITY.Text & "','" & _ dState.Selected Item.Text & "','" & _ ZIP.Text & "','" & _ PNUMBER.Text & "','" & _ ANUMBER.Text & "','" & _ AType.SelectedI tem.Text & "','" & _ BESTTIME.Select edItem.Text & "','" & _ INT_PRICERANGE1 .Text & "," & _ INT_PRICERANGE2 .Text & "," & _ INT_LOCATION.Te xt & "','" & _ INT_WHEN.Text & "','" & _ PRODUCTS.Text & "')" "Tor Bådshaug" wrote:
Well, if your code terminates like this (line 53) it is no wonder you
get an error. By using "& _" the compiler will expect another line of code.
Your code suggests there actually exists a line 54, but somehow it fell
out? Post your line 54 onwards and I will try to help.
Tor Bådshaug tor.badshaug [//at\\] bekk.no.
> Line 53: > "INT_PRICERANGE 2,INT_LOCATION, INT_WHEN,PRODUC TS_PURCHASED) VALUES
('" & _ > > This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Damien |
last post by:
I have just built a simple stopwatch application, but when i f5 to get
things goings i get this message,
An unhandled exception of type 'System.ArithmeticException' occurred in
system.drawing.dll
Additional information: Overflow or underflow in the arithmetic operation.
|
by: Pete |
last post by:
Hi All,
A total Newby with, possibly, a daft question? However, until I can get a
reasonable explanation I am disinclined towards going further. Here goes:
I recently downloaded the latest stable release and once activated it
requested access to the net. Without access it would come up with
recognition and 'localhost' connection errors?
Can anyone please tell me:
|
by: Ask |
last post by:
G'day All,
Just thought I'd drop in and say hi. I'm new to Python, but old to software
development.
Python is one of the languages used in my new job, so I've just bought a
book, read it, and downloaded Python; It's pretty good isn't it? It's
particularly handy being able top run the same bytecode on different
platforms.
|
by: Fred Nelson |
last post by:
Hi:
I have programmed in VB.NET for about a year and I'm in the process of
learing C#. I'm really stuck on this question - and I know it's a "newby"
question:
In VB.NET I have several routines that upload and process images. I can't
get past "square one" with images in C#:
This statement:
|
by: Fred Nelson |
last post by:
I have an applicatioin that I'm writing that uses a "case" file that
contains over 350 columns and more may be added in the future. I would like
to create a dataset with all the column names and only one case record that
is delivered by a stored procedure. (I have a stored procedure that works
so my question is only on loading the DataSet.)
The DataSet will only be used for printing form letters and then will be
zapped. I would like...
| |
by: Fred Nelson |
last post by:
Hi:
I'm developing a web application that needs to have five values, each
retrieved from cookies on many pages.
If I have five "Request.Cookies" commands together does this cause five
"round trips" to the browser or am I accessing one instance.
If five round trips occur then I will develop some parsing algorithm to
save everything I need in one cookie.
|
by: Fred Nelson |
last post by:
Hi:
I'm working on a VS2005 web application and I have what is probabably a
"newby" question.
In VS2003 I could drag a textbox/button/etc on to a form and position it
with the mouse. I converted an app to VS2005 and this still worked.
In VS2005 I can't do this. I have examined the code for VS2003 and I
see that there is a style="Z-INDEX... " in the asp code for the
|
by: johnnyG |
last post by:
Greetings,
I'm studying for the 70-330 Exam using the MS Press book by Tony Northrup
and there are 2 side-by-side examples of using the SHA1CryptoServiceProvider
to create a hash value from a string.
The vb example outputs "A94A8FE5CCB19BA61C4C0873D391E987982FBBD3"
The cs example outputs "5BAA61E4C9B93F3F0682250B6CF8331B7EE68FD8"
for the string "password"
Question: do the 2 applications use different automatic "salts" or "seeds"
to...
|
by: Charles Russell |
last post by:
Why does this work from the python prompt, but fail from a script?
How does one make it work from a script?
#! /usr/bin/python
import glob
# following line works from python prompt; why not in script?
files=glob.glob('*.py')
print files
Traceback (most recent call last):
|
by: alexrixhardson |
last post by:
Hi guys,
I am a newby in the C/C++ world, and I am beginning to work on a
rather simple TCP/IP proxy application which must be able to handle
large volume of data as quickly as possible.
Since this application has to process and distribute plain text around
the network, I am wondering if there are any peformance differences
between C++ std::string and C char in run time?
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |