•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 427,761 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,676 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 22693 | Replies: 15 | Solved
![]() |
I am working on filling a datagrid based on results found from a user entering criteria in text boxes and clicking a search button. I have been toying around with Session() to store variables but I dont understand it too well and its giving me trouble. After the user clicks search, the datagrid should only display the desired rows from a database. I can only achieve this by commenting out the line in the load method as follows. If I do not comment the line, the program works, but I get all possible results of the search every time:
My error when I remove the afore mentioned line of code is as follows:
The IListSource does not contain any data sources.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: The IListSource does not contain any data sources.
Source Error:
Line 77: softwareGrid.DataMember = "[SOFTWARE DATABASE]"
Line 78: softwareGrid.DataKeyField = "Software #"
Line 79: softwareGrid.DataBind()
Line 80: End Sub
Line 81:
Source File: c:\inetpub\wwwroot\ASPproject\WebApplication2\WebForm1.aspx.vb Line: 79
Stack Trace:
[HttpException (0x80004005): The IListSource does not contain any data sources.]
System.Web.UI.DataSourceHelper.GetResolvedDataSource(Object dataSource, String dataMember)
System.Web.UI.WebControls.DataGrid.CreateControlHierarchy(Boolean useDataSource)
System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e)
System.Web.UI.WebControls.BaseDataList.DataBind()
WebApplication2.WebForm1.BindDataGrid() in c:\inetpub\wwwroot\ASPproject\WebApplication2\WebForm1.aspx.vb:79
WebApplication2.WebForm1.softwareGrid_EditCommand(Object source, DataGridCommandEventArgs e) in c:\inetpub\wwwroot\ASPproject\WebApplication2\WebForm1.aspx.vb:193
System.Web.UI.WebControls.DataGrid.OnEditCommand(DataGridCommandEventArgs e)
System.Web.UI.WebControls.DataGrid.OnBubbleEvent(Object source, EventArgs e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
System.Web.UI.WebControls.DataGridItem.OnBubbleEvent(Object source, EventArgs e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()
My code is as follows, with the commented line marked with ***:
There it is. Is there anyway to configure Session() without redirecting the search results to another page? Anyone know?
My error when I remove the afore mentioned line of code is as follows:
The IListSource does not contain any data sources.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: The IListSource does not contain any data sources.
Source Error:
Line 77: softwareGrid.DataMember = "[SOFTWARE DATABASE]"
Line 78: softwareGrid.DataKeyField = "Software #"
Line 79: softwareGrid.DataBind()
Line 80: End Sub
Line 81:
Source File: c:\inetpub\wwwroot\ASPproject\WebApplication2\WebForm1.aspx.vb Line: 79
Stack Trace:
[HttpException (0x80004005): The IListSource does not contain any data sources.]
System.Web.UI.DataSourceHelper.GetResolvedDataSource(Object dataSource, String dataMember)
System.Web.UI.WebControls.DataGrid.CreateControlHierarchy(Boolean useDataSource)
System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e)
System.Web.UI.WebControls.BaseDataList.DataBind()
WebApplication2.WebForm1.BindDataGrid() in c:\inetpub\wwwroot\ASPproject\WebApplication2\WebForm1.aspx.vb:79
WebApplication2.WebForm1.softwareGrid_EditCommand(Object source, DataGridCommandEventArgs e) in c:\inetpub\wwwroot\ASPproject\WebApplication2\WebForm1.aspx.vb:193
System.Web.UI.WebControls.DataGrid.OnEditCommand(DataGridCommandEventArgs e)
System.Web.UI.WebControls.DataGrid.OnBubbleEvent(Object source, EventArgs e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
System.Web.UI.WebControls.DataGridItem.OnBubbleEvent(Object source, EventArgs e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()
My code is as follows, with the commented line marked with ***:
Dim dsSoftware As DataSet = New DataSet()
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
dsSoftware = SoftwareDB.getEntries
Me.BindDataGrid()
Session("dsSoftware") = dsSoftware
Else
'dsSoftware = Session("dsSoftware") *** This is the line that would allow things to work, but causes too many search returns.
End If
End Sub
Private Sub BindDataGrid()
softwareGrid.DataSource = dsSoftware
softwareGrid.DataMember = "[SOFTWARE DATABASE]"
softwareGrid.DataKeyField = "Software #"
softwareGrid.DataBind()
End Sub
Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal E As System.EventArgs) Handles btnSearch.Click
Dim Connect As OleDbConnection = New OleDbConnection()
Dim Adapter As OleDbDataAdapter = New OleDbDataAdapter()
Dim SelectStatement, ConnectString As String
Dim WhereClause As String
WhereClause = "Where "
If txtSoftwareNum.Text <> "" Then
WhereClause = WhereClause & "InStr([Software #],'" & _
txtSoftwareNum.Text & "')>0 AND "
End If
If txtSoftwareName.Text <> "" Then
WhereClause = WhereClause & "InStr([Software Name],'" & _
txtSoftwareName.Text & "')>0 AND "
End If
If txtVersion.Text <> "" Then
WhereClause = WhereClause & "InStr(Version,'" & _
txtVersion.Text & "')>0 AND "
End If
If txtLocation.Text <> "" Then
WhereClause = WhereClause & "InStr(Location,'" & _
txtLocation.Text & "')>0 AND "
End If
If txtSoftwareBrand.Text <> "" Then
WhereClause = WhereClause & "InStr([Soft Brand],'" & _
txtSoftwareBrand.Text & "')>0 AND "
End If
If txtDatePurchased.Text <> "" Then
WhereClause = WhereClause & "InStr(DatePurchased,'" & _
txtDatePurchased.Text & "')>0 AND "
End If
If txtFirstName.Text <> "" Then
WhereClause = WhereClause & "InStr(FirstName,'" & _
txtFirstName.Text & "')>0 AND "
End If
If txtLastName.Text <> "" Then
WhereClause = WhereClause & "InStr(LastName,'" & _
txtLastName.Text & "')>0 AND "
End If
If txtSerialNumber.Text <> "" Then
WhereClause = WhereClause & "InStr([Serial Number],'" & _
txtSerialNumber.Text & "')>0 AND "
End If
If txtModel.Text <> "" Then
WhereClause = WhereClause & "InStr(Model,'" & _
txtModel.Text & "')>0 AND "
End If
If Right(WhereClause, 4) = "AND " Then
WhereClause = Left(WhereClause, Len(WhereClause) - 4)
End If
SelectStatement = "Select * From [SOFTWARE DATABASE] " & WhereClause
' If they didnt enter anything in the textboxes:
If txtSoftwareNum.Text = "" And txtSoftwareName.Text = "" And _
txtVersion.Text = "" And txtLocation.Text = "" And _
txtSoftwareBrand.Text = "" And txtDatePurchased.Text = "" And _
txtFirstName.Text = "" And txtLastName.Text = "" And _
txtSerialNumber.Text = "" And txtModel.Text = "" Then
SelectStatement = "Select * From [SOFTWARE DATABASE]"
Else
End If
ConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\Inetpub\wwwroot\ASPproject\WebApplication2\software\softwaredb.mdb"
Connect.ConnectionString = ConnectString
Adapter.SelectCommand = New OleDbCommand(SelectStatement, Connect)
Adapter.SelectCommand.Connection.Open()
Adapter.Fill(dsSoftware, "[SOFTWARE DATABASE]")
softwareGrid.DataSource = dsSoftware.Tables("[SOFTWARE DATABASE]")
Page.DataBind()
End Sub
Public Sub softwareGrid_EditCommand(ByVal source As Object, _
ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) _
Handles softwareGrid.EditCommand
If Session("Add Mode") = True Then
Dim i As Integer = dsSoftware.Tables("[SOFTWARE DATABASE]").Rows.Count - 1
dsSoftware.Tables("[SOFTWARE DATABASE]").Rows(i).Delete()
Session("AddMode") = False
End If
softwareGrid.EditItemIndex = e.Item.ItemIndex
Me.BindDataGrid()
End Sub
Public Sub softwareGrid_CancelCommand(ByVal sender As Object, ByVal e As DataGridCommandEventArgs) Handles softwareGrid.CancelCommand
If Session("AddMode") = True Then
Dim i As Integer = dsSoftware.Tables("[SOFTWARE DATABASE]").Rows.Count - 1
dsSoftware.Tables("[SOFTWARE DATABASE]").Rows(i).Delete()
Session("AddMode") = False
End If
softwareGrid.EditItemIndex = -1
Me.BindDataGrid()
End Sub
Public Sub softwareGrid_UpdateCommand(ByVal source As Object, ByVal E As DataGridCommandEventArgs) Handles softwareGrid.UpdateCommand
Dim tbSoftwareNum As String
tbSoftwareNum = E.Item.Cells(0).Text
Dim tbSoftwareName As String
tbSoftwareName = CType(E.Item.Cells(1).Controls(0), TextBox).Text
Dim tbVersion As String
tbVersion = CType(E.Item.Cells(2).Controls(0), TextBox).Text
Dim tbLocation As String
tbLocation = CType(E.Item.Cells(3).Controls(0), TextBox).Text
Dim tbSoftBrand As String
tbSoftBrand = CType(E.Item.Cells(4).Controls(0), TextBox).Text
Dim tbDatePurchased As String
tbDatePurchased = CType(E.Item.Cells(5).Controls(0), TextBox).Text
Dim tbFirstName As String
tbFirstName = CType(E.Item.Cells(6).Controls(0), TextBox).Text
Dim tbLastName As String
tbLastName = CType(E.Item.Cells(7).Controls(0), TextBox).Text
Dim tbSerialNumber As String
tbSerialNumber = CType(E.Item.Cells(8).Controls(0), TextBox).Text
Dim tbModel As String
tbModel = CType(E.Item.Cells(9).Controls(0), TextBox).Text
If ValidEntry(tbSoftwareNum, tbSoftwareName, tbLocation) Then
Debug.WriteLine("The row index is:")
Debug.WriteLine(E.Item.ItemIndex)
Debug.WriteLine("This is ds:")
Debug.WriteLine(dsSoftware.GetXml)
Dim dr As DataRow = dsSoftware.Tables("[SOFTWARE DATABASE]").Rows(E.Item.ItemIndex)
Try
dr("Software #") = tbSoftwareNum
dr("Software Name") = tbSoftwareName
dr("Version") = tbVersion
dr("Location") = tbLocation
dr("Soft Brand") = tbSoftBrand
dr("DatePurchased") = tbDatePurchased
dr("FirstName") = tbFirstName
dr("LastName") = tbLastName
dr("Serial Number") = tbSerialNumber
dr("Model") = tbModel
Me.UpdateDataBase()
softwareGrid.EditItemIndex = -1
Me.BindDataGrid()
Session("AddMode") = False
Catch eConstraint As ConstraintException
lblMessage.Text = "A category with that ID already exists."
End Try
End If
End Sub
Private Function ValidEntry(ByVal SoftwareNum As String, ByVal SoftwareName As String, _
ByVal Location As String) As Boolean
ValidEntry = True
If SoftwareNum = "" Then
ValidEntry = False
lblMessage.Text = "Software Number is required."
ElseIf Len(SoftwareNum) > 7 Then
ValidEntry = False
lblMessage.Text = "Software Number must be 7 characters or less."
ElseIf SoftwareName = "" Then
ValidEntry = False
lblMessage.Text = "Software Name is required."
ElseIf Location = "" Then
ValidEntry = False
lblMessage.Text = "A Location for where the software is stored must be specified."
End If
End Function
Private Sub UpdateDataBase()
Select Case SoftwareDB.UpdateEntries(dsSoftware)
Case SoftwareDB.UpdateResult.ConcurrencyError
lblMessage.Text = "Another user has updated that category. Please try again."
Case SoftwareDB.UpdateResult.ForeignKeyError
lblMessage.Text = "That entry is in use."
Case SoftwareDB.UpdateResult.PrimaryKeyError
lblMessage.Text = "Another user has added a category with that software number."
Case SoftwareDB.UpdateResult.OtherOleDbError
lblMessage.Text = "An unspecified OleDb Server error has occurred."
End Select
dsSoftware = SoftwareDB.getEntries
Session("dsSoftware") = dsSoftware
End Sub
There it is. Is there anyway to configure Session() without redirecting the search results to another page? Anyone know?
Search Results don't go to another page, but rather the current page is refreshed (on postback) to display the filtered results.
Of course this line would do just what you say it does:
Because when the page is refreshed on click of the Search button the page returns (posts back to itself), thus goes into you Else clause, and you pass the result set (dataset) which is unfiltered back into it.
LOGIC...LOGIC...LOGIC. I have said this a million times, you must understand logic when coding... Monkey's can type it, people must understand it to follow it.
Sorry...just my little rant, not directly related to you. :mrgreen: :mrgreen:
What happens in your page:
1. Page is Requested
2. The Dataset is passed into the Session Object for storage
3. Your results are filtered and the user clicks the search button
4. The page is refreshed and is thus posted back to itself (PostBack = true)
5. The Dataset from the Session initial load it retrieved and passed into your dataset current dataset.
Of course this line would do just what you say it does:
'dsSoftware = Session("dsSoftware") *** This is the line that would Because when the page is refreshed on click of the Search button the page returns (posts back to itself), thus goes into you Else clause, and you pass the result set (dataset) which is unfiltered back into it.
LOGIC...LOGIC...LOGIC. I have said this a million times, you must understand logic when coding... Monkey's can type it, people must understand it to follow it.
Sorry...just my little rant, not directly related to you. :mrgreen: :mrgreen:
What happens in your page:
1. Page is Requested
2. The Dataset is passed into the Session Object for storage
3. Your results are filtered and the user clicks the search button
4. The page is refreshed and is thus posted back to itself (PostBack = true)
5. The Dataset from the Session initial load it retrieved and passed into your dataset current dataset.
Assistant Manager, Regional Pharmacy Information Systems
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
Believe it or not, Paladine, I knew all that before I posted.
(No really, its true!) Logic is important, although sometimes I am still forced to sift through other people's code in books and such, learning what I can. Trying out what might not yet be fully understood. The part here I didn't understand was whether that session data set can be updated upon clicking search...or if it is just static to the dataset initially given. Perhaps a 2nd separate dataset is in order? Anyone?
Get some sleep Paladine! You sound overworked! :cheesy:
(No really, its true!) Logic is important, although sometimes I am still forced to sift through other people's code in books and such, learning what I can. Trying out what might not yet be fully understood. The part here I didn't understand was whether that session data set can be updated upon clicking search...or if it is just static to the dataset initially given. Perhaps a 2nd separate dataset is in order? Anyone?Get some sleep Paladine! You sound overworked! :cheesy:
Well I am no tired thanks for the suggestion though.
My point was the logic you say you know about is not being conveyed with your question. I was not trying to offend you! But I was trying to make the point that you should ... if pen and paper help to do this...then use it ... right down the flow, and what is happening versus what you want to happen.
For your particular error, the error occurs because it is looking for the Dataset (from the else statement) but you have it commented out. Saying that, the dataset you have commented out is not the one you want.....at the moment..... what it should be is the dataset retrieved following the selections/refinement made just prior to the search button being made. So..... populate the Session variable in the Search_Click event with the "updated" dataset and uncomment out the line in the else statement.... voila?
So see to me that is a logic issue. Not a code issue. See my point? And I agree with this "although sometimes I am still forced to sift through other people's code in books and such, learning what I can" statement, but what you should do is always understand the flow of the logic...the code can be gibberish, as long as the logic is sound you can diagnose the problem.
This error:
is an exception because there is no dataset with that datamember (line 77) available.
So I hope this helps you out...
My point was the logic you say you know about is not being conveyed with your question. I was not trying to offend you! But I was trying to make the point that you should ... if pen and paper help to do this...then use it ... right down the flow, and what is happening versus what you want to happen.
For your particular error, the error occurs because it is looking for the Dataset (from the else statement) but you have it commented out. Saying that, the dataset you have commented out is not the one you want.....at the moment..... what it should be is the dataset retrieved following the selections/refinement made just prior to the search button being made. So..... populate the Session variable in the Search_Click event with the "updated" dataset and uncomment out the line in the else statement.... voila?
So see to me that is a logic issue. Not a code issue. See my point? And I agree with this "although sometimes I am still forced to sift through other people's code in books and such, learning what I can" statement, but what you should do is always understand the flow of the logic...the code can be gibberish, as long as the logic is sound you can diagnose the problem.
This error:
•
•
•
•
Exception Details: System.Web.HttpException: The IListSource does not contain any data sources.
Source Error:
Line 77: softwareGrid.DataMember = "[SOFTWARE DATABASE]"
Line 78: softwareGrid.DataKeyField = "Software #"
Line 79: softwareGrid.DataBind()
Line 80: End Sub
Line 81:
is an exception because there is no dataset with that datamember (line 77) available.
So I hope this helps you out...
Assistant Manager, Regional Pharmacy Information Systems
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
npasma,
Using a pen and paper is a good pratice.
I still use a pen and paper for coding.
Always
1.Get the logic right first.
2.create a small application to test it and UNDERSTAND HOW ITS WORKING
3.Then you code something similar on you main project.
Buddy,You wont believe I read your code 5 times today to help you out but I could not understand whats happening.
Now since I noticed your a cool guy from replying to Paladine remarks(Most of the people wont reply,they just dont come to this website again), there has to be some improvement in your coding style.Dont mistake me.
For your application keep a break point on page load and WATCH WHATS GOING ON.
1.Keep a break point and execute your code.
2.Goto Debug and select Windows and select WATCH ,ME.
3.Hit the F10 key now and see whats going on.
And I also think comments like this could be avoided
Monkey's can type it, people must understand it to follow it.
keep posting, Lets keep the forum alive :cheesy: :cheesy:
Using a pen and paper is a good pratice.
I still use a pen and paper for coding.
Always
1.Get the logic right first.
2.create a small application to test it and UNDERSTAND HOW ITS WORKING
3.Then you code something similar on you main project.
Buddy,You wont believe I read your code 5 times today to help you out but I could not understand whats happening.
Now since I noticed your a cool guy from replying to Paladine remarks(Most of the people wont reply,they just dont come to this website again), there has to be some improvement in your coding style.Dont mistake me.
For your application keep a break point on page load and WATCH WHATS GOING ON.
1.Keep a break point and execute your code.
2.Goto Debug and select Windows and select WATCH ,ME.
3.Hit the F10 key now and see whats going on.
And I also think comments like this could be avoided
Monkey's can type it, people must understand it to follow it.
keep posting, Lets keep the forum alive :cheesy: :cheesy:
Save White Tiger
Thank u guys. Yer heroes. In lights of both of your suggestions, I went back and learned how to use F8 to step thru the code, and really gain a feel for how execution flows. I also finished learning about Session(). I've worked through the code with another ASP.NET programmer, and he is stumped. I'll post again in a minute. brb.
After finishing my research on Session() I have the proper lines of code for what I intend, yet the error persists. My fellow programmers seem perplexed as well. Here are the changes I made:
In the page load method:
This code is from the end of the button Search click method:
Here I update the Session to cause the dataset to contain my search results only.
After stepping through all of the program's execution, I have found that the error occurs as a result of this code:
I've called BindDataGrid before, and it works great. This time, however, it claims there is not dataset source, even though I just gave it one TWO LINES before!!!
Just for review:
So thats where Im at. We are stuck for now. I will revisit this problem tomorrow with some of my coworkers. See what you think! At least I feel better educated now!
In the page load method:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
dsSoftware = SoftwareDB.getEntries
Me.BindDataGrid()
Session("dsSoftware") = dsSoftware
Else
'no code needed here, the previous code returned too much of the dataset
End If
End SubThis code is from the end of the button Search click method:
Connect.ConnectionString = ConnectString
Adapter.SelectCommand = New OleDbCommand(SelectStatement, Connect)
Adapter.SelectCommand.Connection.Open()
Adapter.Fill(dsSoftware, "[SOFTWARE DATABASE]")
softwareGrid.DataSource = dsSoftware.Tables("[SOFTWARE DATABASE]")
Session("dsSoftware") = dsSoftware
Page.DataBind()
End SubAfter stepping through all of the program's execution, I have found that the error occurs as a result of this code:
Public Sub softwareGrid_EditCommand(ByVal source As Object, _
ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) _
Handles softwareGrid.EditCommand
If Session("Add Mode") = True Then
Dim i As Integer = dsSoftware.Tables("[SOFTWARE DATABASE]").Rows.Count - 1
dsSoftware.Tables("[SOFTWARE DATABASE]").Rows(i).Delete()
Session("AddMode") = False
End If
softwareGrid.EditItemIndex = e.Item.ItemIndex
'this is the line that triggers the error:
Me.BindDataGrid()
End SubI've called BindDataGrid before, and it works great. This time, however, it claims there is not dataset source, even though I just gave it one TWO LINES before!!!
Just for review:
Private Sub BindDataGrid()
softwareGrid.DataSource = dsSoftware
softwareGrid.DataMember = "[SOFTWARE DATABASE]"
softwareGrid.DataKeyField = "Software #"
softwareGrid.DataBind()
End SubSo thats where Im at. We are stuck for now. I will revisit this problem tomorrow with some of my coworkers. See what you think! At least I feel better educated now!
Well that is your opinion Letscode, I appreciate you calling me on it, and I respect that. I am not trying to flame you or anyone else for that matter, so please don't take it as that.
Now this is not necessarily directed to you or Npasma (who is cool, and is making an effort) for that matter. But when you spend day after day reading posts that show right from the start that the user is either a. Copied and pasted the code and writes a threads saying "...it doesn't work...why?.." or b. Takes code and with the assumption of understanding what the code does...but has not processed the logic, or c. Post a thread asking for coding help with out showing any effort they have put forth, and provide sketchy details, a person becomes a little frustrated.
And the comment: Monkey's can code it, but people must understand it is valid. Because anyone can type it, but to understand it(process and logic) is the key. Maybe it wasn't the most appropriate way to put it, I admit that, but it the point I was trying to make is appropriate! :!: But your point is well taken. :o :o
My apologies to Npasma and anyone else I may have offended. It was not my intent.
New coders/programmers/developers need to learn logic before they ever go to type a line of code. Then when they go to coding they can focus on efficiency and coding structure. And too often that is not the case, and then all the lovely stickies, and perma-threads are never read.
Saying that lets get to back to what the post is about.
Napsma the code is looking good except you are still missing a piece of logic...at least from what I can see with what you provided......that piece being in your Else statement in the Page_Load event.
The else part of the logic statement is entered on POST back, and that is why it is complaining that there is no DataSet.
So, at the end of the Search Button the dataset should contain ONLY that set of data that matches the criteria supplied. You would store it in a Session variable (call it something different for the sake of confusion). Then in the else statement you would retrieve/pass in that dataset from the Session variable.
Hope that helps!
Now this is not necessarily directed to you or Npasma (who is cool, and is making an effort) for that matter. But when you spend day after day reading posts that show right from the start that the user is either a. Copied and pasted the code and writes a threads saying "...it doesn't work...why?.." or b. Takes code and with the assumption of understanding what the code does...but has not processed the logic, or c. Post a thread asking for coding help with out showing any effort they have put forth, and provide sketchy details, a person becomes a little frustrated.
And the comment: Monkey's can code it, but people must understand it is valid. Because anyone can type it, but to understand it(process and logic) is the key. Maybe it wasn't the most appropriate way to put it, I admit that, but it the point I was trying to make is appropriate! :!: But your point is well taken. :o :o
My apologies to Npasma and anyone else I may have offended. It was not my intent.
New coders/programmers/developers need to learn logic before they ever go to type a line of code. Then when they go to coding they can focus on efficiency and coding structure. And too often that is not the case, and then all the lovely stickies, and perma-threads are never read.
Saying that lets get to back to what the post is about.
Napsma the code is looking good except you are still missing a piece of logic...at least from what I can see with what you provided......that piece being in your Else statement in the Page_Load event.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
dsSoftware = SoftwareDB.getEntries
Me.BindDataGrid()
Session("dsSoftware") = dsSoftware
Else
'no code needed here, the previous code returned too much of the dataset
End If
End SubThe else part of the logic statement is entered on POST back, and that is why it is complaining that there is no DataSet.
So, at the end of the Search Button the dataset should contain ONLY that set of data that matches the criteria supplied. You would store it in a Session variable (call it something different for the sake of confusion). Then in the else statement you would retrieve/pass in that dataset from the Session variable.
Hope that helps!
•
•
•
•
Originally Posted by Letscode
npasma,
Using a pen and paper is a good pratice.
I still use a pen and paper for coding.
Always
1.Get the logic right first.
2.create a small application to test it and UNDERSTAND HOW ITS WORKING
3.Then you code something similar on you main project.
Buddy,You wont believe I read your code 5 times today to help you out but I could not understand whats happening.
Now since I noticed your a cool guy from replying to Paladine remarks(Most of the people wont reply,they just dont come to this website again), there has to be some improvement in your coding style.Dont mistake me.
For your application keep a break point on page load and WATCH WHATS GOING ON.
1.Keep a break point and execute your code.
2.Goto Debug and select Windows and select WATCH ,ME.
3.Hit the F10 key now and see whats going on.
And I also think comments like this could be avoided
Monkey's can type it, people must understand it to follow it.
keep posting, Lets keep the forum alive :cheesy: :cheesy:
Assistant Manager, Regional Pharmacy Information Systems
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
![]() |
•
•
•
•
•
•
•
•
DaniWeb ASP.NET Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
.net .net framework 3.0 access ajax asp breach broadband code combo crime custom daniweb data data protection data transfer database developer development dom drive dropdownlist feed forensics government hard hardware hitachi internet linux microsoft module msdn net news office reader reuse security skin software sql storage terabyte theme vista weather web wikipedia xml xoap
- Program Problem with a select statement to access Data base (C)
- Need to make program access a data base primary key number entered by user (C)
Other Threads in the ASP.NET Forum
- Previous Thread: How to add to a result
- Next Thread: Trouble getting files to display through localhost


Linear Mode