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 ***:

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:

'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.

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:

Also, perhaps you could discuss the error a little bit. Thanks.

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...

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:

And I still havent given up on your code.If I have some time I'll write a clean code for you.

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:

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 Sub

This 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 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:

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 Sub

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:

Private Sub BindDataGrid()
        softwareGrid.DataSource = dsSoftware
        softwareGrid.DataMember = "[SOFTWARE DATABASE]"
        softwareGrid.DataKeyField = "Software #"
        softwareGrid.DataBind()
    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!

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.

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 Sub

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!

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:

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. :cool:

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)

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:


  1. Build and fill each DataTable in a DataSet with data from a data source using a DataAdapter.
  2. Change the data in individual DataTable objects by adding, updating, or deleting DataRow objects.
  3. Invoke the GetChanges method to create a second DataSet that features only the changes to the data.
  4. Call the Update method of the DataAdapter, passing the second DataSet as an argument.
  5. Invoke the Merge method to merge the changes from the second DataSet into the first.
  6. 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?

...
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 :cool:

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:

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. :cool:

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. :)

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. :cool:

Thanks for the details. Sorry I wasn't much help.

Glad you got things working!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.