I have gotten my pages to work up to the final edit page. The code executes on load. Variables are passed by session but I get an SQL syntax error. I've tested the sp I'm calling and it works correctly. Here's the code"
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArg s) Handles Me.Load
Dim strSelDate
Dim strShift
Dim strAbsent
Dim strTO
Dim strHeadCount
Dim strSTDHeadCount
Dim strMPNotes
Dim Notes2
Dim strSQL
Dim strRID
strRID = Session.Item("R ID").ToString ()
strSelDate = Session.Item("S elDate").ToStri ng()
strShift = Session.Item("S hift").ToString ()
strAbsent = Session.Item("A bsent").ToStrin g()
strTO = Session.Item("T O").ToString ()
strHeadCount = Session.Item("H eadCount").ToSt ring()
strSTDHeadCount = Session.Item("S TDHeadCount").T oString()
strMPNotes = Session.Item("N otes").ToString ()
'Notes2 = strMPNotes.Repl ace("'", "''")
strSQL = "UP_MANPOWER_RE CORD_UPDATE '" & strSelDate & "', '" & strShift & "', " & strHeadCount & ", " & strSTDHeadCount & ", " & strAbsent & ", " & strTO & ", '" & Notes2 & "', " & strRID
Dim objConn As New Data.SqlClient. SqlConnection(" Data Source=XXXXXX;I nitial Catalog=XXXXXX; User ID=XXXXXX;passw ord=XXXXXX;")
Dim objCmd As New Data.SqlClient. SqlCommand(strS QL, objConn)
objConn.Open()
objCmd.ExecuteN onQuery()
objConn.Close()
End Sub
Here's the error I get:
System.Data.Sql Client.SqlExcep tion: Line 1: Incorrect syntax near '.'.
Can anyone enlighten this drowning noob??
28 2178 Plater 7,872
Recognized Expert Expert
Are you properly dealing with single quotes in your text?
You need to do a quote replace on all text you try to insert.
so a ' needs to become two of them '' (Note: not a " but ' ' without the space)
Are you properly dealing with single quotes in your text?
You need to do a quote replace on all text you try to insert.
so a ' needs to become two of them '' (Note: not a " but ' ' without the space)
This line replaces single quotes with double quotes in the notes string.
Notes2 = strMPNotes.Repl ace("'", "''")
Plater 7,872
Recognized Expert Expert
Well, it's commented out in your original post for one thing.
And are you doing it for all your other strings too?
I uncommented it after I posted here. That is the only place where the operator can enter any text data. That is the only field that I have this for.
Plater 7,872
Recognized Expert Expert
if any of those sql columns are supposed to be numbers (and not strings) you should NOT be using ' around the values.
Also, are any of those values being stored as a double? or anything that might have a decimal point?
No. The fields are numeric with the exception of Date, and Notes. There is a sub select in the stored procedure the converts the text data for shift to the correct numeric format from a separate table.
Plater 7,872
Recognized Expert Expert
Well then remove the ' around the values for the numeric fields, the ' should only be used on text fields
Well then remove the ' around the values for the numeric fields, the ' should only be used on text fields
There are no ' around any numeric fields in the command.
Plater 7,872
Recognized Expert Expert
There are no ' around any numeric fields in the command.
hehe oops, my mistake, I didn't look at the variable name close enough to see it said it was Date.
If you set a breakpoint here: -
Dim objConn As New Data.SqlClient.SqlConnection("Data Source=XXXXXX;Initial Catalog=XXXXXX;User ID=XXXXXX;password=XXXXXX;")
-
what does the value of your sql query strSQL, look like? Maybe there's something that can be caught by seeing how it is displayed?
By the way, is that a stored procedure you're trying to run there?
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Keiron Waites |
last post by:
Please see the problem in action here: http://www.leadbullet.biz/contact.php
If you mouse over the fields, you will see that text is shown on the right.
The text makes the other fields move when it is shown - even though the
width of the text is less than the width of the field. WHY?
This is driving me nuts - please help!
TIA,
|
by: Marty |
last post by:
It seems all of the sudden that user controls that
contain images are referencing image sources relative to
the document that I drop the control on. This obviously
does not work beacuase the image source is relative to
the user control, not necessarily the form. Can anyone
tell me why this would be the case?
|
by: Simon Harris |
last post by:
Ok, this really is driving me nuts!!! :(
'All' I am trying to do is get the value of a named element. My XML doc
is:
<?xml version="1.0" encoding="utf-16" standalone="yes" ?>
- <Page>
<Title>Test</Title>
<MetaKeywords>Test</MetaKeywords>
|
by: ipmccun |
last post by:
Hello all:
Perhaps someone can shed some light on this: I'm trying to create a
situation, while debugging, where a long running request (sleeps for
15s) and a short running request execute concurrently. Right now, no
matter what I do, it seems that they execute serially. I've verified
(by watching netstat) that two simultaneous connections are being made
to the server, so I'm sure this isnt the standard IE "only two
connections to the...
|
by: trond |
last post by:
Hello all,
Before I start I'd like to point out that I am a complete novice when
it comes to asp.net - My background is in network and operating
systems, and although I have been doing a bit of hobby programming in
vb.net and web programming in asp/vbscript in the past, I am pretty
much a beginner at asp.net.
What I'm trying to do, is to take the "PersonalHomePage" starter kit
that MS supplies with VS2005 and tweak it a bit, to make it...
| |
by: mitsura |
last post by:
Hi,
I need to read a simle XML file. For this I use the SAX parser. So far
so good.
The XML file consist out of number of "Service" object with each object
a set of attributes.
I read through the XML file and for each "<Service>" entry I create a
new service object.
When I am in the "<Service>" part of the XML file and I encounter
|
by: jason.neo |
last post by:
Hi all experts,
I am going nuts with this Invalid postback or callback argument thingy
with .Net 2.0
I am building a file attachment module which relays on a Datatable
stored in session (yeah i know its unhealthy, but its the only "clean"
approach which I can think of to avoid tranfering temp files onto the
server) to maintain the list of attached files before the "commit"
action is done to transfer all the files onto the server.
|
by: mattlightbourn |
last post by:
Hi all,
I have a problem which has been driving me nuts. Crosstab queries!
I have a database witch a few different tables to do with garment manufacturing.
I have a table for a client account, garment type (Jacket, skirt, etc), client sizing spec and descriptives (measurement names i.e: Shoulder to cuff, inside leg, etc), available sizes (ie. 4,6,8,10,12,14,16,18,20,S,M,L,SM,ML,One) and pattern adjustments (if size 10 is the base, the...
|
by: DuncanIdaho |
last post by:
Hello experts
IE 7.0.5730.11
Opera 9.27
Firefox 2.0.0.14
This problem only occurs in Opera and Firefox (amazing, IE does
something right, or maybe not)
Anyway, the problem is that when I put an image in a <divor a <td>
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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: 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: 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...
| |