IListSource does not contain any data sources

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Jun 2005
Posts: 41
Reputation: npasma is an unknown quantity at this point 
Solved Threads: 0
npasma's Avatar
npasma npasma is offline Offline
Light Poster

IListSource does not contain any data sources

 
0
  #1
Jul 26th, 2005
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 ***:

  1. Dim dsSoftware As DataSet = New DataSet()
  2.  
  3. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  4. If Not IsPostBack Then
  5. dsSoftware = SoftwareDB.getEntries
  6. Me.BindDataGrid()
  7. Session("dsSoftware") = dsSoftware
  8. Else
  9. 'dsSoftware = Session("dsSoftware") *** This is the line that would allow things to work, but causes too many search returns.
  10. End If
  11. End Sub
  12.  
  13. Private Sub BindDataGrid()
  14. softwareGrid.DataSource = dsSoftware
  15. softwareGrid.DataMember = "[SOFTWARE DATABASE]"
  16. softwareGrid.DataKeyField = "Software #"
  17. softwareGrid.DataBind()
  18. End Sub
  19.  
  20.  
  21. Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal E As System.EventArgs) Handles btnSearch.Click
  22.  
  23. Dim Connect As OleDbConnection = New OleDbConnection()
  24. Dim Adapter As OleDbDataAdapter = New OleDbDataAdapter()
  25. Dim SelectStatement, ConnectString As String
  26. Dim WhereClause As String
  27.  
  28. WhereClause = "Where "
  29. If txtSoftwareNum.Text <> "" Then
  30. WhereClause = WhereClause & "InStr([Software #],'" & _
  31. txtSoftwareNum.Text & "')>0 AND "
  32. End If
  33. If txtSoftwareName.Text <> "" Then
  34. WhereClause = WhereClause & "InStr([Software Name],'" & _
  35. txtSoftwareName.Text & "')>0 AND "
  36. End If
  37. If txtVersion.Text <> "" Then
  38. WhereClause = WhereClause & "InStr(Version,'" & _
  39. txtVersion.Text & "')>0 AND "
  40. End If
  41. If txtLocation.Text <> "" Then
  42. WhereClause = WhereClause & "InStr(Location,'" & _
  43. txtLocation.Text & "')>0 AND "
  44. End If
  45. If txtSoftwareBrand.Text <> "" Then
  46. WhereClause = WhereClause & "InStr([Soft Brand],'" & _
  47. txtSoftwareBrand.Text & "')>0 AND "
  48. End If
  49. If txtDatePurchased.Text <> "" Then
  50. WhereClause = WhereClause & "InStr(DatePurchased,'" & _
  51. txtDatePurchased.Text & "')>0 AND "
  52. End If
  53. If txtFirstName.Text <> "" Then
  54. WhereClause = WhereClause & "InStr(FirstName,'" & _
  55. txtFirstName.Text & "')>0 AND "
  56. End If
  57. If txtLastName.Text <> "" Then
  58. WhereClause = WhereClause & "InStr(LastName,'" & _
  59. txtLastName.Text & "')>0 AND "
  60. End If
  61. If txtSerialNumber.Text <> "" Then
  62. WhereClause = WhereClause & "InStr([Serial Number],'" & _
  63. txtSerialNumber.Text & "')>0 AND "
  64. End If
  65. If txtModel.Text <> "" Then
  66. WhereClause = WhereClause & "InStr(Model,'" & _
  67. txtModel.Text & "')>0 AND "
  68. End If
  69. If Right(WhereClause, 4) = "AND " Then
  70. WhereClause = Left(WhereClause, Len(WhereClause) - 4)
  71. End If
  72.  
  73. SelectStatement = "Select * From [SOFTWARE DATABASE] " & WhereClause
  74.  
  75. ' If they didnt enter anything in the textboxes:
  76. If txtSoftwareNum.Text = "" And txtSoftwareName.Text = "" And _
  77. txtVersion.Text = "" And txtLocation.Text = "" And _
  78. txtSoftwareBrand.Text = "" And txtDatePurchased.Text = "" And _
  79. txtFirstName.Text = "" And txtLastName.Text = "" And _
  80. txtSerialNumber.Text = "" And txtModel.Text = "" Then
  81. SelectStatement = "Select * From [SOFTWARE DATABASE]"
  82. Else
  83. End If
  84. ConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
  85. "Data Source=c:\Inetpub\wwwroot\ASPproject\WebApplication2\software\softwaredb.mdb"
  86.  
  87. Connect.ConnectionString = ConnectString
  88. Adapter.SelectCommand = New OleDbCommand(SelectStatement, Connect)
  89. Adapter.SelectCommand.Connection.Open()
  90. Adapter.Fill(dsSoftware, "[SOFTWARE DATABASE]")
  91. softwareGrid.DataSource = dsSoftware.Tables("[SOFTWARE DATABASE]")
  92. Page.DataBind()
  93. End Sub
  94.  
  95.  
  96. Public Sub softwareGrid_EditCommand(ByVal source As Object, _
  97. ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) _
  98. Handles softwareGrid.EditCommand
  99.  
  100. If Session("Add Mode") = True Then
  101. Dim i As Integer = dsSoftware.Tables("[SOFTWARE DATABASE]").Rows.Count - 1
  102. dsSoftware.Tables("[SOFTWARE DATABASE]").Rows(i).Delete()
  103. Session("AddMode") = False
  104. End If
  105. softwareGrid.EditItemIndex = e.Item.ItemIndex
  106. Me.BindDataGrid()
  107. End Sub
  108.  
  109. Public Sub softwareGrid_CancelCommand(ByVal sender As Object, ByVal e As DataGridCommandEventArgs) Handles softwareGrid.CancelCommand
  110. If Session("AddMode") = True Then
  111. Dim i As Integer = dsSoftware.Tables("[SOFTWARE DATABASE]").Rows.Count - 1
  112. dsSoftware.Tables("[SOFTWARE DATABASE]").Rows(i).Delete()
  113. Session("AddMode") = False
  114. End If
  115. softwareGrid.EditItemIndex = -1
  116. Me.BindDataGrid()
  117. End Sub
  118.  
  119.  
  120. Public Sub softwareGrid_UpdateCommand(ByVal source As Object, ByVal E As DataGridCommandEventArgs) Handles softwareGrid.UpdateCommand
  121. Dim tbSoftwareNum As String
  122. tbSoftwareNum = E.Item.Cells(0).Text
  123. Dim tbSoftwareName As String
  124. tbSoftwareName = CType(E.Item.Cells(1).Controls(0), TextBox).Text
  125. Dim tbVersion As String
  126. tbVersion = CType(E.Item.Cells(2).Controls(0), TextBox).Text
  127. Dim tbLocation As String
  128. tbLocation = CType(E.Item.Cells(3).Controls(0), TextBox).Text
  129. Dim tbSoftBrand As String
  130. tbSoftBrand = CType(E.Item.Cells(4).Controls(0), TextBox).Text
  131. Dim tbDatePurchased As String
  132. tbDatePurchased = CType(E.Item.Cells(5).Controls(0), TextBox).Text
  133. Dim tbFirstName As String
  134. tbFirstName = CType(E.Item.Cells(6).Controls(0), TextBox).Text
  135. Dim tbLastName As String
  136. tbLastName = CType(E.Item.Cells(7).Controls(0), TextBox).Text
  137. Dim tbSerialNumber As String
  138. tbSerialNumber = CType(E.Item.Cells(8).Controls(0), TextBox).Text
  139. Dim tbModel As String
  140. tbModel = CType(E.Item.Cells(9).Controls(0), TextBox).Text
  141.  
  142.  
  143. If ValidEntry(tbSoftwareNum, tbSoftwareName, tbLocation) Then
  144. Debug.WriteLine("The row index is:")
  145. Debug.WriteLine(E.Item.ItemIndex)
  146. Debug.WriteLine("This is ds:")
  147. Debug.WriteLine(dsSoftware.GetXml)
  148. Dim dr As DataRow = dsSoftware.Tables("[SOFTWARE DATABASE]").Rows(E.Item.ItemIndex)
  149. Try
  150. dr("Software #") = tbSoftwareNum
  151. dr("Software Name") = tbSoftwareName
  152. dr("Version") = tbVersion
  153. dr("Location") = tbLocation
  154. dr("Soft Brand") = tbSoftBrand
  155. dr("DatePurchased") = tbDatePurchased
  156. dr("FirstName") = tbFirstName
  157. dr("LastName") = tbLastName
  158. dr("Serial Number") = tbSerialNumber
  159. dr("Model") = tbModel
  160. Me.UpdateDataBase()
  161. softwareGrid.EditItemIndex = -1
  162. Me.BindDataGrid()
  163. Session("AddMode") = False
  164. Catch eConstraint As ConstraintException
  165. lblMessage.Text = "A category with that ID already exists."
  166. End Try
  167. End If
  168. End Sub
  169.  
  170. Private Function ValidEntry(ByVal SoftwareNum As String, ByVal SoftwareName As String, _
  171. ByVal Location As String) As Boolean
  172. ValidEntry = True
  173. If SoftwareNum = "" Then
  174. ValidEntry = False
  175. lblMessage.Text = "Software Number is required."
  176. ElseIf Len(SoftwareNum) > 7 Then
  177. ValidEntry = False
  178. lblMessage.Text = "Software Number must be 7 characters or less."
  179. ElseIf SoftwareName = "" Then
  180. ValidEntry = False
  181. lblMessage.Text = "Software Name is required."
  182. ElseIf Location = "" Then
  183. ValidEntry = False
  184. lblMessage.Text = "A Location for where the software is stored must be specified."
  185. End If
  186. End Function
  187.  
  188. Private Sub UpdateDataBase()
  189. Select Case SoftwareDB.UpdateEntries(dsSoftware)
  190. Case SoftwareDB.UpdateResult.ConcurrencyError
  191. lblMessage.Text = "Another user has updated that category. Please try again."
  192. Case SoftwareDB.UpdateResult.ForeignKeyError
  193. lblMessage.Text = "That entry is in use."
  194. Case SoftwareDB.UpdateResult.PrimaryKeyError
  195. lblMessage.Text = "Another user has added a category with that software number."
  196. Case SoftwareDB.UpdateResult.OtherOleDbError
  197. lblMessage.Text = "An unspecified OleDb Server error has occurred."
  198. End Select
  199. dsSoftware = SoftwareDB.getEntries
  200. Session("dsSoftware") = dsSoftware
  201. End Sub


There it is. Is there anyway to configure Session() without redirecting the search results to another page? Anyone know?
Reply With Quote Quick reply to this message  
Join Date: Feb 2003
Posts: 793
Reputation: Paladine has a spectacular aura about Paladine has a spectacular aura about Paladine has a spectacular aura about 
Solved Threads: 26
Team Colleague
Paladine's Avatar
Paladine Paladine is offline Offline
Master Poster

Re: IListSource does not contain any data sources

 
0
  #2
Jul 26th, 2005
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:
  1. 'dsSoftware = Session("dsSoftware") *** This is the line that would
  2.  

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, Pharmacy Informatics
Wordpress Learning Blog
Updated : ASP.Net Login Code
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 41
Reputation: npasma is an unknown quantity at this point 
Solved Threads: 0
npasma's Avatar
npasma npasma is offline Offline
Light Poster

Re: IListSource does not contain any data sources

 
0
  #3
Jul 27th, 2005
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:
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 41
Reputation: npasma is an unknown quantity at this point 
Solved Threads: 0
npasma's Avatar
npasma npasma is offline Offline
Light Poster

Re: IListSource does not contain any data sources

 
0
  #4
Jul 27th, 2005
Also, perhaps you could discuss the error a little bit. Thanks.
Reply With Quote Quick reply to this message  
Join Date: Feb 2003
Posts: 793
Reputation: Paladine has a spectacular aura about Paladine has a spectacular aura about Paladine has a spectacular aura about 
Solved Threads: 26
Team Colleague
Paladine's Avatar
Paladine Paladine is offline Offline
Master Poster

Re: IListSource does not contain any data sources

 
0
  #5
Jul 27th, 2005
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:
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, Pharmacy Informatics
Wordpress Learning Blog
Updated : ASP.Net Login Code
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 175
Reputation: Letscode is an unknown quantity at this point 
Solved Threads: 6
Letscode's Avatar
Letscode Letscode is offline Offline
Junior Poster

Re: IListSource does not contain any data sources

 
0
  #6
Jul 27th, 2005
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:
Save White Tiger
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 175
Reputation: Letscode is an unknown quantity at this point 
Solved Threads: 6
Letscode's Avatar
Letscode Letscode is offline Offline
Junior Poster

Re: IListSource does not contain any data sources

 
0
  #7
Jul 27th, 2005
And I still havent given up on your code.If I have some time I'll write a clean code for you.
Save White Tiger
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 41
Reputation: npasma is an unknown quantity at this point 
Solved Threads: 0
npasma's Avatar
npasma npasma is offline Offline
Light Poster

Re: IListSource does not contain any data sources

 
0
  #8
Jul 27th, 2005
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.
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 41
Reputation: npasma is an unknown quantity at this point 
Solved Threads: 0
npasma's Avatar
npasma npasma is offline Offline
Light Poster

Re: IListSource does not contain any data sources

 
0
  #9
Jul 27th, 2005
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:
  1. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  2. If Not IsPostBack Then
  3. dsSoftware = SoftwareDB.getEntries
  4. Me.BindDataGrid()
  5. Session("dsSoftware") = dsSoftware
  6. Else
  7. 'no code needed here, the previous code returned too much of the dataset
  8. End If
  9. End Sub
  10.  

This code is from the end of the button Search click method:
  1. Connect.ConnectionString = ConnectString
  2. Adapter.SelectCommand = New OleDbCommand(SelectStatement, Connect)
  3. Adapter.SelectCommand.Connection.Open()
  4. Adapter.Fill(dsSoftware, "[SOFTWARE DATABASE]")
  5. softwareGrid.DataSource = dsSoftware.Tables("[SOFTWARE DATABASE]")
  6. Session("dsSoftware") = dsSoftware
  7. Page.DataBind()
  8. End Sub
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:

  1. Public Sub softwareGrid_EditCommand(ByVal source As Object, _
  2. ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) _
  3. Handles softwareGrid.EditCommand
  4.  
  5. If Session("Add Mode") = True Then
  6. Dim i As Integer = dsSoftware.Tables("[SOFTWARE DATABASE]").Rows.Count - 1
  7. dsSoftware.Tables("[SOFTWARE DATABASE]").Rows(i).Delete()
  8. Session("AddMode") = False
  9. End If
  10. softwareGrid.EditItemIndex = e.Item.ItemIndex
  11. 'this is the line that triggers the error:
  12. Me.BindDataGrid()
  13. End Sub
  14.  

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:
  1. Private Sub BindDataGrid()
  2. softwareGrid.DataSource = dsSoftware
  3. softwareGrid.DataMember = "[SOFTWARE DATABASE]"
  4. softwareGrid.DataKeyField = "Software #"
  5. softwareGrid.DataBind()
  6. End Sub

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!
Reply With Quote Quick reply to this message  
Join Date: Feb 2003
Posts: 793
Reputation: Paladine has a spectacular aura about Paladine has a spectacular aura about Paladine has a spectacular aura about 
Solved Threads: 26
Team Colleague
Paladine's Avatar
Paladine Paladine is offline Offline
Master Poster

Re: IListSource does not contain any data sources

 
0
  #10
Jul 28th, 2005
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.
  1. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  2. If Not IsPostBack Then
  3. dsSoftware = SoftwareDB.getEntries
  4. Me.BindDataGrid()
  5. Session("dsSoftware") = dsSoftware
  6. Else
  7. 'no code needed here, the previous code returned too much of the dataset
  8. End If
  9. End Sub
  10.  

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!

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, Pharmacy Informatics
Wordpress Learning Blog
Updated : ASP.Net Login Code
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC