protoculture Posted May 9, 2005 Posted May 9, 2005 I have created a class to handle all my database I/O. I have set up a method to pass in sql statements in that class and I'm hoping to get that method to return a recordset object. How can I return a recordset object to my calling class? ( am I even approaching this correctly? , thanks for your consideration ) Quote
michael_hk Posted May 9, 2005 Posted May 9, 2005 public DataTable GetData(string sql) { // get connection, execute sql, whatever // eg. DataTable dt = WhatEverMethod(); return dt; } Quote There is no spoon. <<The Matrix>>
protoculture Posted May 9, 2005 Author Posted May 9, 2005 public DataTable GetData(string sql) { // get connection, execute sql, whatever // eg. DataTable dt = WhatEverMethod(); return dt; } thanks for that quick reply. So what about on my original class part? Do I have to create a datatable in that as well and then fill it with the returned object? Quote
michael_hk Posted May 9, 2005 Posted May 9, 2005 thanks for that quick reply. So what about on my original class part? Do I have to create a datatable in that as well and then fill it with the returned object? Yep, with something like this DataTable dt = obj.GetData("Select * from myTable"); Quote There is no spoon. <<The Matrix>>
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.