DataSource Controls :: Finding Code To Loop Through The Reader And Output The Details On Individual Lines Of The Page

Jan 14, 2010

I'm currently trying to build a html table from the results of a sql data reader. As my table has multiple records, I want the code to loop through the reader and output the details on individual lines of the page. In ASP I have done this in the past using something like

[Code]....

but as I am using data readers I'm not sure what the equivalent is.

View 3 Replies


Similar Messages:

DataSource Controls :: Loop Through Reader Using VB?

Jan 7, 2010

how I can loop through the results in VB, I only ever seem to get the last row, I would like to list all rows.

My code is below

[Code]....

View 3 Replies

Forms Data Controls :: Two Lines In The Header To Get An Output Of Two Lines?

Jan 21, 2010

In the header text I need to get an output of two lines. The top one in Spanish an the lower one in english. Is there a way to break a line?

[Code]....

View 8 Replies

ADO.NET :: Can't Get Reader.hasrows And Reader.read To Work Together In Code Behind

Feb 22, 2011

I have some code in my vb.net code behind that queries a database, and if there is data, outputs it from the codebehind to a datalist on my asp.net page. In addition to sending the data to the datalist on the page, I need to take the value from "mbillaty" that is returned from the sql query, and have that value be the selected value for a drop down box also on the page. I can get either the datalist to fill, or the selected value for the dropdown box to be selected depending upon which bit of code I place before the other (ARGH), but I can't get them to both work together on the page. What am I doing wrong?

[Code]....

View 2 Replies

How To Get From Loop Session On Data Reader

Nov 26, 2010

I am trying to send session on Loop and trying get .

[code]....

In above code, I just only get same SessionId on every news headings, how do I get next row session id?

View 2 Replies

Adding Images In Loop (while Reader.read) Fails

Mar 27, 2011

I have following code that I can only add one image per row although I can add Listbox items as I wanted.

If "imgtag" 1~5 is checked, I get these in the listbox.

ie. ImageID = "cat"

listbox1. item gets - cat1, cat2, cat3, cat4, cat5

however I can only create the last image instead of 5 images.

- imageID - cat5

I assign each image unique ID.

If reader2.HasRows Then
While reader2.Read
Dim img1 = Convert.ToString(reader2("imgtag1"))
Dim img2 = Convert.ToString(reader2("imgtag2"))
Dim img3 = Convert.ToString(reader2("imgtag3"))
Dim img4 = Convert.ToString(reader2("imgtag4"))
Dim img5 = Convert.ToString(reader2("imgtag5"))
Dim blogimg = Convert.ToString(reader2("ImageID"))
Dim a As New HyperLink
a.Attributes.Add("onclick", "return hs.expand(this)")
a.Attributes.Add("href", "../../blog/images/" + blogimg)
Dim img As Image = New Image
img.ImageUrl = "~/blog/images/" + blogimg
img.Width = 200
If img1 = "1" Then
Dim blogimg1 As HtmlTableCell = CType(FindControl("blogimg1"), HtmlTableCell)
img.ID = blogimg + "1"
a.Controls.Add(img)
blogimg1.Controls.Add(a)
ListBox1.Items.Add(blogimg + "1")
End If
If img2 = "1" Then
Dim blogimg2 As HtmlTableCell = CType(FindControl("blogimg2"), HtmlTableCell)
img.ID = blogimg + "2"
a.Controls.Add(img)
blogimg2.Controls.Add(a)
ListBox1.Items.Add(blogimg + "2")
End If
If img3 = "1" Then
Dim blogimg3 As HtmlTableCell = CType(FindControl("blogimg3"), HtmlTableCell)
img.ID = blogimg + "3"
a.Controls.Add(img)
blogimg3.Controls.Add(a)
ListBox1.Items.Add(blogimg + "3")
End If
If img4 = "1" Then
Dim blogimg4 As HtmlTableCell = CType(FindControl("blogimg4"), HtmlTableCell)
img.ID = blogimg + "4"
a.Controls.Add(img)
blogimg4.Controls.Add(a)
ListBox1.Items.Add(blogimg + "4")
End If
If img5 = "1" Then
Dim blogimg5 As HtmlTableCell = CType(FindControl("blogimg5"), HtmlTableCell)
img.ID = blogimg + "5"
a.Controls.Add(img)
blogimg5.Controls.Add(a)
ListBox1.Items.Add(blogimg + "5")
End If
End While

View 2 Replies

Finding Crystal Report, Pdf Conversion And Adobe Reader?

Jan 21, 2011

My asp.net app used Crystal report to display as pdf file.

If I open the report in my pc (newest version, Adobe reader 9), it is ok but once I open app in web server (Adobe reader 8), it display a blank screen.

View 2 Replies

DataSource Controls :: How To See The Size Of The Individual Tables

May 13, 2010

From using the command: EXEC sp_spaceused on a SQL 2008 database,

the DB has a size of 642.56 MB, unallocated space 148.77 MB.

I can also see the size of the individual tables from the same command:

Reserved: 103656 KB
Data: 98264 KB
Index_size: 2656 KB
Unused: 2736 KB

What I don't quite get is why the total database size is 642.56 MB when the size of the individual tables is so much smaller. We pay for the total amount, in chunks of 500 MB. I was trying to see which tables where causing the DB to be so big, but to me, it looks like it is not the size of the tables but something else.

What should I look at to figure out why we are taking up so much space? Am I not understanding how this works?

View 6 Replies

DataSource Controls :: Insert Into Text.boxes Details From User And Get Record Into DB On Other Page

May 22, 2010

when need to insert into Text.boxes details from user (name,e-mail, e.tc.) and to get record of it into DB on other page. I try to get after pressing Submit btn:

DataSource.InsertCommandType=SQLDataSourceCommandType.StoredProcedire
DataSource.InsertCommand="CustomerInsert" ....,

but I'm getting: Server.Transfer("ErrorHangler.aspx")

View 10 Replies

DataSource Controls :: Getting Error For Last Two Lines

Jan 2, 2010

I am getting error messages for the last two lines of the following button click event handler code where I am attempting to create a new record in my Profiles table with 3 column entries:

protected void ButtonSubmit_Click(object sender, EventArgs e)
{
string Callsign = Server.HtmlEncode(Textbox1.Text);
string Password = Server.HtmlEncode(Textbox2.Text);
string Email = Server.HtmlEncode(TextBox3.Text);
DataClassesDataContext db = new DataClassesDataContext();
Profile profile = new Profile();
profile.Callsign = Callsign;
profile.Password = Password;
profile.Email = Email;
db.Profiles.Add(profile);
db.SubmitChanges(profile);
}

The first error message refers to the "Add" statement in the second to last line. It states, 'Syatem.Data.Linq.Table<Profile>' does not contain a definition for 'Add'. The last 2 errors refer to the last line. They state "The best overloaded method match
for 'Syatem.Data.Linq.DataContext.SubmitChanges(Syatem.Data.Linq.ConflictMode)' has some invalid arguments" and "Argument '1': cannot convert from 'profile' to 'Syatem.Data.Linq. ConflictMode'".

View 3 Replies

DataSource Controls :: Retrieving Tables Using Reader?

Jan 20, 2010

I'm quite new to ASP.NET and i was wondering if someone could answer some of my questions.1. What is the difference between a DataTable and an Array? Is the DataTable a serverside control? Is it exposed to the user?2. Does the reader retrieve the column names? If so- how can I capture them? Are they the first row?2. Is it possible to populate an Array using the following sort of code, and if so- how?:

SqlCommand tableCommand = new SqlCommand();
SqlConnection tableConnection = new SqlConnection();
tableCommand.Connection = tableConnection;

[code]...

View 2 Replies

Can't Get Nested Loop To Output

Apr 29, 2010

I cant get my nested loop to output the right code:

If pagesreader.Read() Then
' if subtitle exists then output
mydata = "<h2>" & pagesreader.Item("documentcategoryname") & "</h2>"
While pagesreader.Read()
mydata &= "<h2>" & pagesreader.Item("documentcategoryname") & "</h2>"
If (pagesreader.Item("documentcat") = pagesreader.Item("documentcategoryid")) Then
mydata &= "<p>" & pagesreader.Item("documentname") & "</p>"
End If
End While
End If
produces:
About Us
About Us
doccy4
Map Of Medicine
doccy5

When I need it to procude:
About Us
doccy3
doccy4
Map Of Medicine
doccy

View 7 Replies

Web Forms :: Loop Textboxes By ID In Code Behind Page?

Jan 6, 2010

I need to know how to loop the user input value in textboxes programatically. For example I have 3 rows of textboxes i have programatically generated with id txtCategory1, txtCategory2, txtCategory3. Since I generated all these textboxes programatically I have no idea how many textboxes will be there. I need to do a looping again to get the value user put in into textbox. How can I get the value of textbox by using ID?

View 4 Replies

DataSource Controls :: Populating Textboxes Via Data Reader ?

Sep 29, 2010

Here is what I have tried:

txtCost.Text = string.Format("{o:c}", dr["Cost"]);

Here is the error I receive. How can I format the data that is coming from the data reader into currency format??? Also, is there a way to format it into currency without the dollar sign?

Input string was not in a correct format. Description: An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.FormatException: Input string was not in a correct format.

View 4 Replies

DataSource Controls :: How To Check That Data Reader Is Null

Jun 4, 2010

[Code]....

but if table is empty i.e. there is no record for Store_no=storeno then it bill_id = (Convert.ToInt32(reader[0]) + 1); give a Null exception.

I want to set bill_id=1 if there is no previous record in table of that particular store number. then How to do this.

i.e. How to check that reader[0] is null

cmd1 = new SqlCommand(" Select Max(Bill_No) From Bill_Record Where Store_no='" + storeno + "'", hookUp);

View 3 Replies

DataSource Controls :: Reader.close() And Transaction.commit()?

Feb 8, 2010

I'm getting "This SqlTransaction has completed; it is no longer usable" exception when try to commit my transaction after sqlreader is close.Here is the code sample

[Code]....

...so when I get to commit the transaction it raises the mentioned exception: "This SqlTransaction has completed; it is no longer usable". I have also noticet that Command.Transaction becomes NULL after reader.Close()My question is: Can I use SqlDataReader and SqlTransaction ? Maybe to use BeginExecuteReader and EndExecuteReader ?

View 3 Replies

DataSource Controls :: Search Table Column For Substring / Individual Tags

Jan 27, 2010

I have an SQL table which looks similar to the following:

Title | Author | Tags
'title1' 'author1' 'horror, steven king, clowns'
'title2' 'author2' 'childrens, roald dahl, chocolate'

Let's say I wanted to find the name of a book that has the tag 'clowns' in it...how can I do this? 'clowns' is a substring of the tag for 'title1'...but how do I search for substrings? I have tried to use the "LIKE" keyword but obviously it doesn't work in this situation.

View 1 Replies

DataSource Controls :: Can Update A Record In A Table That Has Been Read By Reader

Apr 10, 2010

I have been able to successfully read a row of data from an SQL table using two column parameters. Now I would like to update this row with new information. Is this possible since the reader does not specify which row was read with the 'reader.Read();' command?

View 7 Replies

DevExpress Generates Thousands Of Lines Of ASP Code / How To Reduce The Code,

Nov 24, 2010

After insert a grid or any other tool into an aspx page it generates enough code for that tool(for ex.): <dx:ASPxGridView ID=ASPxGridView1 runat="server"></dx:ASPxGridView>...

But,after adding any property to this control (like Show group Panel) it generates more than 3000 lines of code in aspx page () and after adding any other tool the code is increasing in a enormous way...

How can I reduce the code, maybe there is a property(settings) in DevExpress option...

View 2 Replies

Web Forms :: What Is The Syntax For Finding A Control In A Content Page From Javascript Code In The Master Page

Jan 16, 2011

I have a control in a content page that I want to find the width and left attributes of the style. I am trying to find this from Javascript code that exists on the Master Page. How do I do that?

View 1 Replies

Web Forms :: Pop Details Message In Loop?

Feb 17, 2010

how can i show message to client while server is running in loop?

like system that send mails ,i have like sleep between each of the item in the loop

and i want to show some details about the sending

i tried to do it like that:

[Code]....

but it show only the last one

View 3 Replies

Forms Data Controls :: Putting Gridview Into Editmode Having Datasource=reader

Sep 14, 2010

I have a GV that is populated via a reader: Using reader As SqlDataReader = cmd.ExecuteReader() I have autogenerate edit button=T but it will not go into editmode. Must I create template to handle this?

View 4 Replies

DataSource Controls :: Trying To Load A Mysql Reader Text Into A Textbox But Failing?

May 24, 2010

I am trying to pass a mysql reader string variable into a textbox so on the asp front end it will automatically show the resultset as soon as the page is loaded. The following is my code:

protected void Page_Load(object sender, EventArgs e)
{
if (!Page.isPostback)

[code]...

View 4 Replies

SQL Server :: How To Get Output As A Whole When Uasge Of Loop In Stored Procedure

Jul 19, 2010

I have written SP like this to get my required output.create procedure [dbo].[usp_gl_ProjectBudgets] set nocount on begin tran declare @SPError int

declare @y1 varchar(20)
declare @y2 varchar(20)
declare @y3 varchar(20)
declare @y4 varchar(20)
declare @y5 varchar(20)
declare @Glink int
declare @i int
set @y1='Year1'
set @y2='Year2'
set @y3='Year3'
set @y4='Year4'
set @y5='Year5'
set @Glink=1
set @i=1
[code]...

View 7 Replies

Web Forms :: Loop Output To Literal Control Only Shows Last Value?

Aug 12, 2010

I have a Button1_Click event that I want to display the first 7 records of a dataset by looping through them and presenting on the page in a Literal Control. All of the database code is working fine because when I use the Response.Write statement below, the first 7 rows are dumped at the page top before the HTML. But, when I replace the Response.Write with the Literal1.Text as shown below, only the last (7th) record is displayed on the page.

Here is the code section in question:

for (int
i = 0; i <= 6; i++)
{
DataRow dr = dt.Rows[i];
string text1 = dr["Question"].ToString();
//Response.Write(text1);
Literal1.Text = text1;
}

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved