CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > NEWSGROUP > Asp.Net Forum > starter_kits_and_source_projects.microsoft_application_blocks Tags:
Item Type: NewsGroup Date Entered: 2/25/2005 9:30:38 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 4 Views: 208 Favorited: 0 Favorite
5 Items, 1 Pages 1 |< << Go >> >|
mparker1113_2
Asp.Net User
Application Datablocks SQLHelper.ExecuteReader2/25/2005 9:30:38 PM

0

Hello,

I am attempting to load an SQLReader using the microsoft's data application blocks sqlhelper.executereader method.

I am not getting an error in my code at run time, but am not getting data to load, either.

Can anyone spot my error?


Try
Dim reader As SqlDataReader = SqlHelper.ExecuteReader(cnString, "getProductsByCategory", 16)
drpdwnlist2.DataSource() = reader
drpdwnlist2.DataTextField = "ProductName"
drpdwnlist2.DataBind()
'Return reader
Catch ex As Exception
Response.Write(ex.Message)
End Try

lookabout
Asp.Net User
Re: Application Datablocks SQLHelper.ExecuteReader2/26/2005 2:01:30 PM

0

Here is an example pulled directly out of the Enterprise Library quickstart example for VB.

' Retrieves a list of customers from the database.
' Returns: List of customers in a string.
' Remarks: Demonstrates retrieving multiple rows of data using
' a DataReader
Public Function GetCustomerList() As String

' DataReader that will hold the returned results
' Create the Database object, using the default database service. The
' default database service is determined through configuration.
Dim db As Database = DatabaseFactory.CreateDatabase()

Dim sqlCommand As String = "Select CustomerID, Name, Address, City, Country, PostalCode " & _
"From Customers"
Dim dbCommandWrapper As DBCommandWrapper = db.GetSqlStringCommandWrapper(sqlCommand)

Dim readerData As StringBuilder = New StringBuilder

' The ExecuteReader call will request the connection to be closed upon
' the closing of the DataReader. The DataReader will be closed
' automatically when it is disposed.
Dim dataReader As IDataReader = db.ExecuteReader(dbCommandWrapper)

' Iterate through DataReader and put results to the text box.
' DataReaders cannot be bound to Windows Form controls (e.g. the
' resultsDataGrid), but may be bound to Web Form controls.
While (dataReader.Read())
' Get the value of the 'Name' column in the DataReader
readerData.Append(dataReader("Name"))
readerData.Append(Environment.NewLine)
End While
dataReader.Close()
Return readerData.ToString()
End Function
mparker1113_2
Asp.Net User
Re: Application Datablocks SQLHelper.ExecuteReader2/27/2005 12:34:17 AM

0

I will try that, thanks.
mparker1113_2
Asp.Net User
Re: Application Datablocks SQLHelper.ExecuteReader2/27/2005 1:06:56 AM

0

I am getting errors when attempting to use objects of type: Database, DBCommandWrapper, and StringBuilder.

I do not have enterprise version of VS -- but have imported microsoft.applicationblocks.data

Any suggestions for what I need ?
Lookabout
Asp.Net User
Re: Application Datablocks SQLHelper.ExecuteReader3/1/2005 5:53:20 PM

0

I would get the lastest Enterprise Library applications blocks.

This makes it really easy.

You can download it here for free (must register first but still free.)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/entlib.asp

There are some quick start examples included, one of which is a data reader.

Remember to set up your database configuration first.

Study the Providers notes in the article by Rob Howard HERE: first
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspnet/html/asp02182004.asp

and part2 here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspnet/html/asp04212004.asp

These help understand the configuration a bit better (even though they do not DIRECTLY) address that.

For a quick and easy example of using the blocks in ASP.net, see this article by Scott Mitchell:
http://aspnet.4guysfromrolla.com/articles/022305-1.aspx

5 Items, 1 Pages 1 |< << Go >> >|


Free Download:


Web:
Application Datablocks SQLHelper.ExecuteReader - ASP.NET Forums I am attempting to load an SQLReader using the microsoft's data application blocks sqlhelper.executereader method. ...
CodeProject: Application DataBlock Extender Code Generator using ... Feb 18, 2005 ... WriteLine("/* Code Generated by Application DataBlock " + "Extender Code Generator") ... ExecuteReader(strConnString , ", "return SqlHelper. ...
Chris Love's Official ASP.NET Blog : Object must implement ... Feb 24, 2006 ... I use the Application Data Blocks to wrap up all my interaction with the database, trust me you want to use them too, ... Dim dr As SqlDataReader = SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, _ ...
ASPAlliance.com : The #1 ASP.NET Developer Community : Microsoft ... In my previous article, I introduced you to the Microsoft Application Blocks for .NET. ... It uses the SqlHelper class to return multiple Rows via a SqlDataReader: ... As you can see, the ExecuteReader method opens and closes the .... The first thing to note has absolutely nothing to do with the Data Block per se. ...
binding combobox to sqlreader? Im using the code in Microsoft Application Data block for net Code heres the code dr = SqlHelper.ExecuteReader(connection, "invoice2") ...

Application Datablocks SQLHelper.ExecuteReader - ng.asp-net-forum ... Application Datablocks SQLHelper.ExecuteReader, > ROOT > NEWSGROUP > Asp.Net Forum ...






how to make panel 'visible' programmatically using findcontrol

loading a tree view.

page_loadcomplete event not firing on content page

how to add a treenode

master page - accessing the <body> tag without runat = server

how to do postback using masterpage?

sitemap path does not work

changing the menu user control programmatically

how to indicate separator in "site map"

mysql and masterpages

load page outside of website into master page control

javascript problem in masterpage

load parts of a xml tree

sqlsitemapprovider role issue

get a control from master page

default button with master page

how do i disable treenodes

skin for custom web control

is it possible to update the control at server-side ?

adrotator & imagemap - need your help.

wizard w/ validationsummary in navigationtemplates

asp:menu - only show links to sub-items in current section

resizing the contentplaceholder in the masterpage.

menu control on master pages

treeview and navigateurl problem

regarding master page in asp.net 2.0

treeview nodes alphabetic order.

showing error message in masterpage label control

web.sitemap help

webresource.axd problem in menu control

   
  Privacy | Contact Us
All Times Are GMT