What amendments to the ASP.NET 3.5. VB code below output the MSSQL stored
procedure dataset result to XML (as a response stream)?
(I also guessing to use Response.Conten tType = "text/xml"):
Imports System.Data.Sql Client
Imports System.Data
Partial Class pages_default
Inherits System.Web.UI.P age
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArg s) Handles Me.Load
'Output stored procedure result as XML
'--------------------------------------------
Dim sqlConnection1 As New
SqlConnection(s fGeneral.fGetCo nnectionString( ))
Dim cmd As New SqlCommand
Dim dr As SqlDataReader = Nothing
cmd.Connection = sqlConnection1
cmd.CommandText = "uspXMLSour ce"
cmd.CommandType = CommandType.Sto redProcedure
cmd.Parameters. AddWithValue("@ EnterLanguageCo de",
Session("strLan guageSetting"))
Try
sqlConnection1. Open()
dr = cmd.ExecuteRead er
If dr.HasRows Then
dr.Read()
End If
Catch ex As SqlException
Throw ex
Finally
sqlConnection1. Close()
sqlConnection1. Dispose()
End Try
End Sub
End Class 2 1791
On Oct 8, 2:27*am, "Mark B" <none...@none.c omwrote:
What amendments to the ASP.NET 3.5. VB code below output the MSSQL stored
procedure dataset result to XML (as a response stream)?
(I also guessing to use Response.Conten tType = "text/xml"):
Imports System.Data.Sql Client
Imports System.Data
Partial Class pages_default
* * Inherits System.Web.UI.P age
*Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArg s) Handles Me.Load
* * * * 'Output stored procedure result as XML
* * * * '--------------------------------------------
* * * * Dim sqlConnection1 As New
SqlConnection(s fGeneral.fGetCo nnectionString( ))
* * * * Dim cmd As New SqlCommand
* * * * Dim dr As SqlDataReader = Nothing
* * * * cmd.Connection = sqlConnection1
* * * * cmd.CommandText = "uspXMLSour ce"
* * * * cmd.CommandType = CommandType.Sto redProcedure
* * * * cmd.Parameters. AddWithValue("@ EnterLanguageCo de",
Session("strLan guageSetting"))
* * * * Try
* * * * * * sqlConnection1. Open()
* * * * * * dr = cmd.ExecuteRead er
* * * * * * If dr.HasRows Then
* * * * * * * *dr.Read()
* * * * * * End If
* * * * Catch ex As SqlException
* * * * * * Throw ex
* * * * Finally
* * * * * * sqlConnection1. Close()
* * * * * * sqlConnection1. Dispose()
* * * * End Try
* * End Sub
End Class
Use DataSet, it can retrieve XML from relational data.
Example:
Dim ds As New dataset
Dim connStr As String = "database=North Wind;Data
Source=localhos t;User id=sa;password= sa"
Using conn As New SqlConnection(c onnStr)
Dim command As New SqlCommand("sel ect * from customers",
conn)
conn.Open()
ds.DataSetName = "Customers"
ds.Load(command .ExecuteReader( ),
LoadOption.Over writeChanges, "customers" )
Response.Conten tType = "text/xml"
ds.WriteXml(Res ponse.OutputStr eam)
End Using This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Steve Holden |
last post by:
Has anyone, with any driver whatsoever, managed to retrieve output
parameters from a SQL Server stored procedure? I've just been rather
embarrassed to find out it's not as easy as it might seem, and people
are saying bad things about Python as a result :-(
mx.ODBC, which I regard as a highly-capable module, does not support the
callproc() API, and suggests use of the ODBC call format. It has caveats
in (some of) the documentation...
|
by: Bari Allen |
last post by:
I have a Stored procedure in SQL, that works, when tested in SQL, with one
input & several output parameters, as follows:
CREATE PROCEDURE myProcedure
@MyID int
, @First varchar(80) OUTPUT
, @Second varchar(80) OUTPUT
, @Third varchar(80) OUTPUT
, @Amount as numeric(18,0) OUTPUT
etc.
|
by: Begoña |
last post by:
in my java application I've made a call to this stored procedure
CREATE procedure pruebaICM
@pANI varchar(20),
@pTABLA varchar(20),
@pInsert varchar(500),
@pUpdate varchar(1000),
@pFLAG varchar(1),
@pResultado int OUTPUT
|
by: Jay Chan |
last post by:
I am trying to use a command line program to run a stored procedure
that generates output in a comma-delimitted format. Somehow, ISQL or
OSQL always wrap the lines at 256 characters. I believe this has
something to do with the column width switch (-w). But enlarging the
column width to 800 characters max still doesn't help. The following
is a stored procedure that is essentially doing what my stored
procedure is doing:
create procedure...
|
by: laurenq uantrell |
last post by:
I need to get the value of an output parameter back into my VBA
function calling a stored procedure.
I'm using the following construction to append a new record in a SQL
Server table:
Function ThisFunctionInsertsANewRecord()
On Error GoTo myErr
Dim cmd As ADODB.Command
| |
by: Christopher Weaver |
last post by:
I'm having trouble accessing the value of an output parameter of a stored
procedure. The SP looks like this:
SET TERM ^ ;
CREATE PROCEDURE SP_NEW_TASK
RETURNS (
"uidTask" INTEGER)
AS
begin
|
by: Bari Allen |
last post by:
ASP Classic question:
I have a Stored procedure in SQL, that works, when tested in SQL, with one
input & several output parameters, as follows:
CREATE PROCEDURE myProcedure
@MyID int
, @First varchar(80) OUTPUT
, @Second varchar(80) OUTPUT
, @Third varchar(80) OUTPUT
, @Amount as numeric(18,0) OUTPUT
|
by: MS |
last post by:
Here's my simple stored procedure:
ALTER PROCEDURE GetMemberIDByEmail
@Email EmailAddress,
@ID int OUTPUT
AS
SELECT @ID = ID FROM tbl_Member WHERE Email=@Email
RETURN
|
by: Mr Not So Know It All |
last post by:
im new to SQL Server and ASP.Net. Here's my problem. I have this SQL
Server stored procedure with an input parameter and output parameter
CREATE PROCEDURE .
@in_rc varchar(8)
@out_eList varchar(7) output
AS
select @out_eList = ecuid from _organization where rccode = @in_rc
GO
|
by: IamtheEvster |
last post by:
Hi All,
I am currently using PHP 5 and MySQL 5, both on Fedora Core 5. I am
unable to call a MySQL stored procedure that returns output parameters
using mysql, mysqli, or PDO. I'm having a hell of a time with it...
The following comes from phpinfo():
PHP Version: 5.1.2
mysql Client API version: 5.0.18
mysqli Client API version: 5.0.18
|
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: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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: 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: 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...
| |