| | |
IListSource does not contain any data sources
Please support our ASP.NET advertiser: Intel Parallel Studio Home
Thread Solved |
I took your advice, and made a special session variable called "dsTest" to use at the end of my search button click method, and then I used dsTest in the else statement of the page load method.
The result is this:
Value cannot be null. Parameter name: dataSet
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.ArgumentNullException: Value cannot be null. Parameter name: dataSet
Source Error:
Line 159: Adapter.SelectCommand = New OleDbCommand(SelectStatement, Connect)
Line 160: Adapter.SelectCommand.Connection.Open()
Line 161: Adapter.Fill(dsSoftware, "[SOFTWARE DATABASE]")
Line 162: softwareGrid.DataSource = dsSoftware.Tables("[SOFTWARE DATABASE]")
Line 163: Session("dsTest") = dsSoftware
Its claiming the data set is null...very interesting. Well, its past 5, and my brain is shot. Will do more work tomorrow. Just wanted to keep you all posted in case you were curious.
The result is this:
Value cannot be null. Parameter name: dataSet
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.ArgumentNullException: Value cannot be null. Parameter name: dataSet
Source Error:
Line 159: Adapter.SelectCommand = New OleDbCommand(SelectStatement, Connect)
Line 160: Adapter.SelectCommand.Connection.Open()
Line 161: Adapter.Fill(dsSoftware, "[SOFTWARE DATABASE]")
Line 162: softwareGrid.DataSource = dsSoftware.Tables("[SOFTWARE DATABASE]")
Line 163: Session("dsTest") = dsSoftware
Its claiming the data set is null...very interesting. Well, its past 5, and my brain is shot. Will do more work tomorrow. Just wanted to keep you all posted in case you were curious.
Have you step through it with the debugger?
IListsource (original error) is still bothering me... I would read up on that, as you seem to implementing it at somepoint.
Here is what microsoft states about it (used for Datatable and DataSet, not a datagrid)
IListsource (original error) is still bothering me... I would read up on that, as you seem to implementing it at somepoint.
Here is what microsoft states about it (used for Datatable and DataSet, not a datagrid)
•
•
•
•
A DataSet can read and write data and schema as XML documents. The data and schema can then be transported across HTTP and used by any application, on any platform that is XML-enabled. You can save the schema as an XML schema with the WriteXmlSchema method, and both schema and data can be saved using the WriteXml method. To read an XML document that includes both schema and data, use the ReadXml method.
In a typical multiple-tier implementation, the steps for creating and refreshing a DataSet, and in turn, updating the original data are to:
- Build and fill each DataTable in a DataSet with data from a data source using a DataAdapter.
- Change the data in individual DataTable objects by adding, updating, or deleting DataRow objects.
- Invoke the GetChanges method to create a second DataSet that features only the changes to the data.
- Call the Update method of the DataAdapter, passing the second DataSet as an argument.
- Invoke the Merge method to merge the changes from the second DataSet into the first.
- Invoke the AcceptChanges on the DataSet. Alternatively, invoke RejectChanges to cancel the changes.
Note The DataSet and DataTable objects inherit from MarshalByValueComponent, and support the ISerializable interface for remoting. These are the only ADO.NET objects that can be remoted.
I also notice something else curious in your code:
In your edit command you delete a row in a table? Why would you ever delete a row you are editing?
Also, there is no "equals" in your WHERE clause creation? And nothing your are comparing? WHERE columnA = ? Is not in your WHERE clause creation?
ASP.NET Syntax (Toggle Plain Text)
... Dim WhereClause As String WhereClause = "Where " If txtSoftwareNum.Text <> "" Then WhereClause = WhereClause & "InStr([Software #],'" & txtSoftwareNum.Text & "')>0 AND " End If .. ... .... SelectStatement = "Select * From [SOFTWARE DATABASE] " & WhereClause
It should be more like WhereClause = "WHERE = ". And the statement : "InStr([Software #],'" & txtSoftwareNum.Text & "')>0 AND " will result in a number/integer being returned from the InStr function, 0, or greater than zero. So if it returns an integer, then you would have this in the where clause : # > 0 Which would be a true or false result from that comparison. So how would it return anything in a SELECT * FROM software WHERE ?? = true would make no sense. Unless the ?? is a column that contains either True or False as a value.
Make sense? There is no Comparison Column, no equal sign, and the comparison value would not make sense? So my guess is this: "Select * From [SOFTWARE DATABASE] " & WhereClause is returning an EMPTY or NULL dataset, because nothing is retrieved that matches your WHERE Clause. Thus, it is this reason as to why you are getting this error message.
Again...go through and debug it line by line...I will bet you will see the values being retrieved are not what you think.
Hope this helps
p.s. I had to write this three times, since the storm killed the power while writing it, and browser crashed in the middle of the second time, so I apologize if I seem scattered in this reply.
OK, well first of all, I would proudly like to announce that this problem has been officially solved- due to some changes in page load and some clever use of session variables. I now have a program that sucessfully searches and updates the database. All I have to do now is finish the insert functionallity for new records and I'm done. If anyone would like to see the finished code, just let me know and I'll post it.
And Paladine, whoa dude- about that select query not being valid after the where- look again. The if structure I created changes the query dynamically based on which categories the user chooses to search by. Each if may add on some code to the query followed by an AND. The last if statement uses LEN to cut off the final AND. For instance, if you search by Software Number, the "WhereClause" as I named it looks something like this:
"Where InStr([Software #],'1A 0001')>0 "
Anyhoo, I thought it was fairly clever if I do say so myself. So yah, thanks for your help everyone. Im not done yet, I need to get back to work- but feel free to request a posting of whichever "fixed up" methods u might like to see and I will post them. Good luck all. :cheesy: :cheesy: :cheesy:
And Paladine, whoa dude- about that select query not being valid after the where- look again. The if structure I created changes the query dynamically based on which categories the user chooses to search by. Each if may add on some code to the query followed by an AND. The last if statement uses LEN to cut off the final AND. For instance, if you search by Software Number, the "WhereClause" as I named it looks something like this:
"Where InStr([Software #],'1A 0001')>0 "
Anyhoo, I thought it was fairly clever if I do say so myself. So yah, thanks for your help everyone. Im not done yet, I need to get back to work- but feel free to request a posting of whichever "fixed up" methods u might like to see and I will post them. Good luck all. :cheesy: :cheesy: :cheesy:
Glad to hear it.
But it is a new one on me that you have an SQL WHERE clause without an "equals" sign. Your method is a pretty niffty way of doing it, I applaud you on that.
But it is a new one on me that you have an SQL WHERE clause without an "equals" sign. Your method is a pretty niffty way of doing it, I applaud you on that.
Yeah, I admit my method is a bit unusual. Here's my rationale: If a user enters a partial value into one of the text boxes, the InStr method will pick up on that and return all values containing that string portion. As for the lack of the equals symbol, the greater than symbol works just as well in this particular situation. Its all seems to be legal! Different strokes for different folks I guess. 

•
•
•
•
Originally Posted by Paladine
Glad to here it.
But it is a new one on me that you have an SQL WHERE clause without an "equals" sign. Your method is a pretty niffty way of doing it, I applaud you on that.
![]() |
Similar Threads
- 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
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.net 2.0 activexcontrol advice ajax alltypeofvideos anathor application asp asp.net bc30451 bottomasp.net box browser button c# checkbox click commonfunctions confirmationcodegeneration css dataaccesslayer database datagridview datagridviewcheckbox datalist deadlock development dgv dropdownlist dynamically edit expose feedback fileuploader fill flash form formatdecimal forms formview google grid gridview gudi iframe iis javascript list listbox login microsoft mono mouse mssql multistepregistration news numerical objects opera panelmasterpagebuttoncontrols parent project radio redirect registration relationaldatabases reportemail richtextbox rotatepage save schoolproject search security select silverlight smartcard smoobjects software sql-server sqlserver2005 suse textbox tracking unauthorized validation vb.net video videos view virtualdirectory vista visualstudio web webapplications webdevelopemnt webprogramming webservice xsl youareanotmemberofthedebuggerusers





