473,395 Members | 1,468 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

question about datareader in function

Hi,

i use this to recover data via a stored procedure from a database.

Imports System.Data
Imports System.Data.SqlClient
Public Class chat
Public Shared Function myfunction() As DataSet
Dim dsdata As DataSet = New DataSet()
.....
end function
end class

Now i wondered whether it would work with DataReader, but in the
Intellisense of Visual Web Dev. there is no Datareader to see.
Is it not available and if no, why?

Thanks
Chris
Oct 5 '07 #1
4 1262
On Oct 5, 1:04 pm, "Chris" <c...@spam.itwrote:
Hi,

i use this to recover data via a stored procedure from a database.

Imports System.Data
Imports System.Data.SqlClient
Public Class chat
Public Shared Function myfunction() As DataSet
Dim dsdata As DataSet = New DataSet()
....
end function
end class

Now i wondered whether it would work with DataReader, but in the
Intellisense of Visual Web Dev. there is no Datareader to see.
Is it not available and if no, why?

Thanks
Chris
Chris,
Try using SqlDataReader, not just DataReader

Oct 5 '07 #2
Indeed ... thanks
why sqldatareader and not sqldataset ??

"Charlie Brown" <cb****@duclaw.comschreef in bericht
news:11*********************@50g2000hsm.googlegrou ps.com...
On Oct 5, 1:04 pm, "Chris" <c...@spam.itwrote:
>Hi,

i use this to recover data via a stored procedure from a database.

Imports System.Data
Imports System.Data.SqlClient
Public Class chat
Public Shared Function myfunction() As DataSet
Dim dsdata As DataSet = New DataSet()
....
end function
end class

Now i wondered whether it would work with DataReader, but in the
Intellisense of Visual Web Dev. there is no Datareader to see.
Is it not available and if no, why?

Thanks
Chris

Chris,
Try using SqlDataReader, not just DataReader

Oct 5 '07 #3
On Oct 5, 1:25 pm, "Chris" <c...@spam.itwrote:
Indeed ... thanks
why sqldatareader and not sqldataset ??

"Charlie Brown" <cbr...@duclaw.comschreef in berichtnews:11*********************@50g2000hsm.goo glegroups.com...
On Oct 5, 1:04 pm, "Chris" <c...@spam.itwrote:
Hi,
i use this to recover data via a stored procedure from a database.
Imports System.Data
Imports System.Data.SqlClient
Public Class chat
Public Shared Function myfunction() As DataSet
Dim dsdata As DataSet = New DataSet()
....
end function
end class
Now i wondered whether it would work with DataReader, but in the
Intellisense of Visual Web Dev. there is no Datareader to see.
Is it not available and if no, why?
Thanks
Chris
Chris,
Try using SqlDataReader, not just DataReader- Hide quoted text -

- Show quoted text -
Dataset belongs to System.Data and SqlDataReader belongs to
System.Data.SqlClient, since the DataSet is used independant of any
datasource.

The DataReader is optimized for SQL Server, so it is placed in
SQLClient, likewise their is also a OleDbDataReader,
OracleClientDataReader, etc...

Oct 5 '07 #4
Ok, thanks

"Charlie Brown" <cb****@duclaw.comschreef in bericht
news:11*********************@19g2000hsx.googlegrou ps.com...
On Oct 5, 1:25 pm, "Chris" <c...@spam.itwrote:
>Indeed ... thanks
why sqldatareader and not sqldataset ??

"Charlie Brown" <cbr...@duclaw.comschreef in
berichtnews:11*********************@50g2000hsm.go oglegroups.com...
On Oct 5, 1:04 pm, "Chris" <c...@spam.itwrote:
Hi,
>i use this to recover data via a stored procedure from a database.
>Imports System.Data
Imports System.Data.SqlClient
Public Class chat
Public Shared Function myfunction() As DataSet
Dim dsdata As DataSet = New DataSet()
....
end function
end class
>Now i wondered whether it would work with DataReader, but in the
Intellisense of Visual Web Dev. there is no Datareader to see.
Is it not available and if no, why?
>Thanks
Chris
Chris,
Try using SqlDataReader, not just DataReader- Hide quoted text -

- Show quoted text -

Dataset belongs to System.Data and SqlDataReader belongs to
System.Data.SqlClient, since the DataSet is used independant of any
datasource.

The DataReader is optimized for SQL Server, so it is placed in
SQLClient, likewise their is also a OleDbDataReader,
OracleClientDataReader, etc...

Oct 5 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: VB Programmer | last post by:
I have a function that returns a datareader. The problem is that in the function's FINALLY I close the datareader and set it to nothing. But, BEFORE the Finally I "Return" the datareader (in the...
2
by: Donald Williamson | last post by:
I have a DataReader that I am binding to a Repeater control. In the DataReader, I have two fields: 'Name1' and 'Name2' 'Name1' will always have a person's name. Name2 periodically has a person's...
1
by: Jim via DotNetMonster.com | last post by:
Hi, I'm trying to set one of the columns in the datareader to a variable so that I can use it in a different function. When I do that then all the other values in the data reader don't show up....
7
by: Arsalan | last post by:
I have a function which return datareader Public Shared Function ReturnDReader(ByVal query As String) As OleDbDataReader Dim Connection_String As String =...
4
by: Shapper | last post by:
Hello, I have this code to bind a DataGrid to a DataReader when page loads: Sub Page_Load(Sender As Object, e As EventArgs) dgContent.DataSource = drContent dgContent.DataBind() End Sub ...
3
by: tshad | last post by:
I am trying to set up a class to handle my database accesses. I can't seem to figure out how to get the return value from my dataReader from these routines (most of which I got elsewhere). They...
4
by: Shapper | last post by:
Hello, I have created a datareader function in a asp.net/vb web site. The datareader returns only one record with 2 fields: and In the same aspx.vb I want to use this values as follows:...
4
by: James Radke | last post by:
Hello, I am looking for guidance on best practices to incorporate effective and complete error handling in an application written in VB.NET. If I have the following function in a class module...
5
by: jjmraz | last post by:
Hi, I have a situation where in a dll a SqlDataReader is created on a function call but is never closed. The datareader gets passed back to the asp.net page calling it. How should I close the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
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...
0
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.