XML STRING Passed To Stored Proc
I am using SQL SERVER 2005 and ASP.
Would anyone be kind enough to give me a solution to the problem below please?
If for example in the stored procedure looks like this:
-- Initialize the SQL Server XML stored procedures
EXEC sp_xml_preparedocument @xmlDoc OUTPUT, @xmlString
Insert into @TableBook
SELECT * FROM OPENXML (@xmlDoc, 'books/book') WITH
(
bookNameVARCHAR(100) 'name',
authorVARCHAR(100) 'author'
)
The question is supposing there is a node called 'Surname' but I am not adding 'Surname' to 'Author'. If I want to check 'Surname' value DOES exists and I want to replace it with 'Author' or if 'Surname' does not exist, just use 'Author' node instead.
I am not sure how you can use IF statement to check a node and put the value into SET @surname and then put something like author VARCHAR(100) '@surname' OR author VARCHAR(100) '@Author'. Just like switching it around.
View Replies
ADVERTISEMENT
I need to also add an AND after the where like
WHERE (Id = @CId)
and MAX(end) < NOW()
CREATE PROCEDURE dbo.[sp_rsgroup]
@Id int
AS
SELECT ISNULL(Group, '') AS GroupCalc, MIN(start) AS START, COUNT(Id) AS Count
FROM Table
WHERE (Id = @CId)
GROUP BY ISNULL(Group, '')
ORDER BY start
GO
View Replies
View Related
What is the simplest way to open up a stored query in Access - I'v got this far but I need to open: qry_Listings.
set cnn = Server.CreateObject("ADODB.Connection")
strCon = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &
Server.MapPath("../database/listings.mdb") '//This one is for Access
2000/2002
cnn.Open strCon
View Replies
View Related
as I'm in the process of performance tuning, I'm trying to receive a NUMBER type array from a Stored Procedure.I made a VARRAY OF NUMBER in my stored procedure. I'm not able to receive this in a Function in ASP.
View Replies
View Related
I would like to call my stored proc and invoke the WITH RECOMPILE option. I can't figure out what to set in ADO to make that happen. how to make this work? BTW, I _don't_ want to create the stored proc using the WITH RECOMPILE.
View Replies
View Related
I need to open a Recordset with a dynamic cursor from a Stored Proc. Does anyone have the syntax?
View Replies
View Related
I am trying to pass a VBScript Date variable as value to an ADO adDate
parameter of a stored procedure (which runs in an SQL Server).
If I add the parameter like this:
oCmd.Parameters.Append oCmd.CreateParameter( "@p_Date", adDate,
adParamInput, , dParam)
where oCmd is of type ADODB.Command and dParam is a VBScript variable of
type Date
then when trying to execute the stored procedure I get the following error:
Optional feature not implemented
I was able to get round this by passing a string value in an adVarChar
parameter, but it would be easier and more readable with adDate and
Date-type variables. Is this latter possible?
View Replies
View Related
Is it possible to call a stored procedure asynchronously from an ASP page?
We would like to be able to execute a proc and have the page continue to
process without having to wait for the proc to finish. I know you can make
a dll and call it from there, but we'd rather just be able to keep it simple
and call it from the page if we can.
View Replies
View Related
I am trying to run the following t-sql stored proc from my VBScript page
Create Procedure getUserInfo
(
@login nvarchar(8)
)
AS
USE proj_dashboard
SELECT f_forename, f_surname, f_profile_id
FROM t_users
WHERE f_login = @login
basically I wasnt to pull in the login of the user pass it to the proc and pull out the info for that user. I use the following sql statement Code:
View Replies
View Related
I've got a problem with an ASP page which calls a stored proc. The sybase stored procedure returns numeric values as shown: ...
View Replies
View Related
I've created a Stored Procedure which adds a new record and updates some more records and then returns the primary key for the added record.
The SP seems to work OK, but I'm having problems getting at the returned key in my ASP code:
"Item cannot be found in the collection corresponding to the requested name or ordinal."
A common error, but in this case I can't see why... I output the SQL instruction that is sent to the DB and have run it in Query Analyser and it runs OK and returns a single row, with a single column - the new primary key...
But when I try and access this in ASP, I get the error message....
View Replies
View Related
I need to return XML from a SQL Stored Procedure which I will execute through ASP ADO code. Stored Procedure as below:
CREATE PROCEDURE pr_GetJobInfo2
@JobType int,
@CntryID int,
@JobTitle varchar(8000) OUTPUT
AS
SELECT @JobTitle = ltrim(rtrim(JobTitle))
FROM dbo.JOBS
WHERE JobType = @JobType
AND CntryID = @CntryID
FOR XML AUTO
[code]
Now the output parameter (@JobTitle) cannot be assigned to FOR XML, so what must I do ??? My ASP code reads as: ....
View Replies
View Related
Does anyone know how ASP calls a stored procedure in ORACLE ? I want the stored procedure to return a recordset bact to the ASP environment.
Can a stored procedure in ORACLE return a recordset to ASP. If so can you direct me to the necessary syntax that can be useful for this ?
View Replies
View Related
Is it possible to add a stored proc to a table adapter and execute the proc
inside an ASP button click event?
I have a table adapter called Claimers and a sp called AddWatch. On the
onclick event I would like to call the table adapter and execute the sp.
Note that the sp does not return records. Code:
View Replies
View Related
I have an Elapsed time column in my database. This is stored as a varchar. I would like to be able to calculate these values and place on my asp page.
Below is an example of a value in my database:
2:00:49
This is 2 hours and 49 seconds. I would like the return value to be in Hours:Minutes:Seconds
Any ideas?
View Replies
View Related
I have the following stored procedure:
CREATE PROCEDURE [dbo].[GET_CategoryCurrentNewsList]
@Category VARCHAR
AS
BEGIN
SELECT dbo.News_Joined.NewsTitle, dbo.News_Joined.NewsID
FROM dbo.News_Joined
WHERE (dbo.News_Joined.StartDate <= GETDATE()) AND (dbo.News_Joined.EndDate >= GETDATE()) AND (dbo.News_Joined.CategoryID IN (@Category))
END
GO
dbo.news_Joined.CategoryID is an INT, and @Category is a string such as (1000, 1010, 1020). However, no results are returned. I figured I had to do something to do some string conversions from INT to VARCHAR or something, but I can't use CSTR. I do not know how many numbers will be passed to @Category, so making seperate variables isn't an option.
Any ideas???
View Replies
View Related
when guarding against sql injection attack from modified form or
querystring variables is it enough to strip out just apostrophes...if the
variable USERNAME is the name of a text box passed to a script is the below
always safe...
q1="select * from TABLENAME where username='" &
trim(replace(request("USERNAME"),"'","''")) & "'"
View Replies
View Related
I've never seen this before. I am new to querystrings, as just using hidden
fields and the POST method has been more than adequate for me until
recently. But I started using the GET method, and I noticed that when I
clicked the submit button, it gave me this for a URL:
http://localhost/DisplayTickets.ASP...nsearchTSE.y=11
The thing is, selectTSE and Status are the two <SELECT> boxes, so I
understand them being there. But why is is telling me the x and y
coordinates of where I clicked the button to submit the form?
I should add that the submit button is an image, not a regular button.
This doesn't hurt anything, just wondering why it's there. And maybe it will
hurt something later on; I don't know enough to say.
View Replies
View Related
can cookies be passed from a pop up "secure folder log in" window, provided by my hosting company? As I would like to display a welcome message with their name when they log in.
View Replies
View Related
when i try passing a numeric value as a string("0004") using asp to a stored procedure, the value is stored as 4 and not as 0004 in the table. In the table and stored procedure the value type is nvarchar.
View Replies
View Related
I have a page that passes a variable in to an sql query
It parses the string (a date) for month and year.
It works when i use the date() function Code:
View Replies
View Related
I'm trying to pass paramter values to another .aspx page via a querystring. The record in the db table looks something like this lahlahlah. The value that gets passed looks like this lahblahblah. So basically the is not getting passed.
Here's what my querystring looks like: Code:
View Replies
View Related
i need to add a variable brought into the
script like: script.asp?variable=var
and i need to make it for use in
var1 = request.querystring("var")
mySQL = "SELECT * FROM members WHERE nick = 'VAR1'"
can anyone tell me how to do this?
View Replies
View Related
When i submit this form all the record values are being passed to the next asp page. But i want only those records which the user has changed in this page.
View Replies
View Related
I would like to clean up my mailing list by changing the URL I use at the moment which is in the format
www.mysite.com/view_pic.asp?pic_number=123
To be
http://www.mysite.com/view_pic.asp?p...il=bob@bob.com
it would then insert the email into a table, collect these for a while and only see these as active members.Any ideas how to do this, I've tried a few things but no luck.
View Replies
View Related
I am trying to work out the length of time that a page was opened till it reached another page, I amusing the script below Code:
View Replies
View Related
does anyone know why my session number doesnt stay the same when i pressed refresh?
it works on w2k, but not on w2k server
my programmer thinks that the IIS is not passing the session back to the client. is there a way to check or any other alternative for sessions?
View Replies
View Related
I am creatiung a track record website which displays a list of branches and how many people are available at each individual time slot.
I thought the best way to update would be to create a link which passed two variables, the branch and what time slot. This would then be retrieved int he book.asp page which then would knock one of the current count. I came up with the below page: Code:
View Replies
View Related
my ASP code creates a form and an array of chekbox with this statement response.write "<input type='checkbox' name='chkProduct" & Cstr(counter) & "' value='delete'>" all goes well and i also have a button that points to a VBScript function passing one parameter the counter start value so i can loop throught the checkboxs on the client side and determine if checked or not.
Ok i can display my command "document.frmProductCart.chkProduct & (Cstr(counter)) & .checked" as a string in alert but cannot make it as a command like it should be, anyone got any pointers ?
View Replies
View Related
I have created a database connection function which I use to open my database connection and recordset and another to close it. Easy stuff I know. The problem is this.
I want to be able to create database conenctions and recordsets specifically when I call the function. For example Code:
View Replies
View Related
I have a ton of TD attributes that have to be changed based on the
data in the DB. All TD elements are ID and runat=server.
Changing the attributes of a SINGLE TD is simple:
<td id=thisTD runat=server>
thisTD.Attributes.Clear();
thisTD.Attributes.Add("Class",reader["thisTD_Class"].toString());
Now, say we have 100 TD elements with IDs TD_1 to TD_100
I have not been able to find a way to (essentially) say:
for(int i=0;i<100;i++){
"TD_"+i.Attributes.Clear();
"TD_"+i.Attributes.Add("Class",reader["TDClass"+i].toString());
}
in J-Script, I could do it by Eval() or about eight ways through the
DOM. It seems crazy to me that if I can access the Attributes of a
specific element directly by ID (thisTD.Attributes), I couldn't also
access it by reference.
But I have been able to find NOTHING to indicate how this may be done.
Obviously, my problem is not limited to a single attribute, or else I
would have just typed them all out by now. Trouble is, there is a lot
of logic that must be applied to the data before setting the
attribute. Without being able to iterate or loop by reference, I will
be typing for ages just to change some freaking classes.
View Replies
View Related
I have encountered some strange behaviour when using the XMLHTTP Request object in Javascript to return xml from a C# Webservice Method. I create a SOAP envelope and send it off to the Webservice, which I have debug points in, which when hit I can see that all the parameters are coming thru as null....
View Replies
View Related
I'm developing an Asp.NET system to take a CSV file uploaded via the web, parse it, and insert the values into an SQL database. My sticking point comes when I try to split() the string returned by readline() on the file.
The following code snippet works for me:
tokens = "one,two,three,four".Split(",")
for each token in tokens
response.write("<td>"+token+"</td>")
next
However, if I take the next line in the CSV, read using StreamReader.ReadLine on the PostedFile.InputStream, I receive "Object reference not set to an instance of an object." which I have narrowed down to be my string holding the line. Further investigation reveals that no other string member functions work on my line (.ToCharArray, .ToString, etc).
I suspect that StreamReader.ReadLine is not correctly returning a string, even though Response.Write(line) displays what I would expect .....
View Replies
View Related