J
jason
Hello - looking for an NEWBIE example/fix if someone could help me.
I've been using the following technique to pull and push sql2000 data
through my asp.net pages. It works fine and is nice and clean.
I know there is a cleaner way (while still using this technique) of
passing a single value back to asp.net without having to return a
dataset. Can someone point me to an example.
Many THANKS for any help or information.
CODE (may not be syntaxtically exact, but the idea has worked). Please
retain this same design of a compiled VB DLL and sql2000 stored
procedure in your solution):
IN THE VB DLL:
================
Public Function nextqna(ByVal currentq As String) As DataSet
Dim mydataseta As DataSet = New DataSet("MyDataSeta")
Dim da As New SqlDataAdapter
Dim con As SqlConnection = New
SqlConnection("server=XXX.XXX.XXX.XXX;uid=sa;pwd=XXXXXX;database=XXX")
con.Open()
Dim cmd As SqlCommand = new sqlcommand("dbo.[nextqna]", con)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add("@currentq",SqlDbType.varchar).Value = currentq
da.SelectCommand = cmd
da.Fill(mydataseta)
Return mydataseta
end function
IN THE SQL2000 STORED PROC:
==================
create procedure [nextqna]
@currentq varchar(120)AS
SELECT COUNT(q) from qna where q=@currentq
IN THE ASPX:
===============
Dim yy2 As class2
yy2 = new class2()
Dim mydatasetb2 As DataSet
mydatasetb2= yy2.nextqna("001")
I've been using the following technique to pull and push sql2000 data
through my asp.net pages. It works fine and is nice and clean.
I know there is a cleaner way (while still using this technique) of
passing a single value back to asp.net without having to return a
dataset. Can someone point me to an example.
Many THANKS for any help or information.
CODE (may not be syntaxtically exact, but the idea has worked). Please
retain this same design of a compiled VB DLL and sql2000 stored
procedure in your solution):
IN THE VB DLL:
================
Public Function nextqna(ByVal currentq As String) As DataSet
Dim mydataseta As DataSet = New DataSet("MyDataSeta")
Dim da As New SqlDataAdapter
Dim con As SqlConnection = New
SqlConnection("server=XXX.XXX.XXX.XXX;uid=sa;pwd=XXXXXX;database=XXX")
con.Open()
Dim cmd As SqlCommand = new sqlcommand("dbo.[nextqna]", con)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add("@currentq",SqlDbType.varchar).Value = currentq
da.SelectCommand = cmd
da.Fill(mydataseta)
Return mydataseta
end function
IN THE SQL2000 STORED PROC:
==================
create procedure [nextqna]
@currentq varchar(120)AS
SELECT COUNT(q) from qna where q=@currentq
IN THE ASPX:
===============
Dim yy2 As class2
yy2 = new class2()
Dim mydatasetb2 As DataSet
mydatasetb2= yy2.nextqna("001")