shootsnlad Posted August 16, 2002 Posted August 16, 2002 I used the data form wizard to create a form that a user can use to access an access database. I feel the need to have a 'find' button on the form. I have tried to look for the code to do it, but was unable to find anything. I have an object, a connection, and a data adapter. I thought that if I used the object, I would be able to do a search throughout the database. I was unable to find any function that would do it. I know that things like searching the database can be complicated, but I'm sure there is a way. I am doing a simple inputbox to get what the user needs to find, and then search a particular field in the database. Thanks for the help! Quote
shootsnlad Posted August 19, 2002 Author Posted August 19, 2002 Well I was able to do a find on the primary key through the dataset, but it returns a datarow object. So I am able to find the row I want, but how do I tell the dataset to go to my datarow that I just found? Thanks! Quote
*Gurus* divil Posted August 19, 2002 *Gurus* Posted August 19, 2002 I haven't done any data access with .net, but I think you access rows of a dataset something like: DataSet.Tables(n).Rows(n) So once you have the index, you should be ok. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
shootsnlad Posted August 19, 2002 Author Posted August 19, 2002 My problem is that I can not find the datarow in the dataset that I am looking for. For some reason, I can not retrieve the index of that row. I figured if I have the index from the row I retrieved, then I can do a dataset.table.position = ____ The buttons that I have for first,last,next,previous all use that position indicator to tell where in the dataset I am at. You would think that by doing a dataset.table.find and retrieving a row, you should be able to switch positions to the row you find. Boy, this .NET is tough to figure out. It sure doesn't help that the .NET help system is really bad too. Anyone have any idea? or atleast an idea of where I could go to get the answer? Quote
*Gurus* divil Posted August 19, 2002 *Gurus* Posted August 19, 2002 I didn't think there *was* a "position" in a dataset. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
shootsnlad Posted August 20, 2002 Author Posted August 20, 2002 best way Ok, now I'm not sure I'm using the best way to do what I want. I will provide an explanation and I was wondering if there may be a better tool to use to accomplish my task. Here is what I want to do: I have an Access Database that is linked to an Informix database. I have 3 tables that I want to interact with in that database. I want a form for each table. On each form would be various fields designated for each field in the database. I want the person to load a particular form, and then be able to navigate through the database. The user should be able to do things like: next, previous, first, last. I want buttons for Adding, Changing, Deleting and Finding a particular record. Here is what I have done: I used the data from wizard in .NET. It built me everything above, except for the find button. I currently am able to navigate through the database, as well as add, change, and delete a record. Any ideas? I appreciate the feedback. shootsnlad Quote
shootsnlad Posted August 21, 2002 Author Posted August 21, 2002 fixed! I got it working. In my code, after I had found the datarow, I was recording the position of the dataset at that time, apparently the .position never changes even though I was moving through the dataset, so instead I recorded the for...next variable that I was using to find out what record I was on. I then assigned the current position to that, and it works just fine. Thanks for the help! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.