Hi
I've started working on an application that is not class based and making it class based at this stage in development would be too much work. The good thing about classes is that you can get all the details for a single row from a particular table (e.g. SELECT * FROM CLIENT WHERE CLIENTID = @CLIENTiD). Then you can get any value of the class by doing something like me.txtName.text = ClassClient.FullName
Anyway if you can imagine our client table has about 30 fields in it. So we could technically have 30 different functions (where each function calls the same stored procedure e.g. SELECT * FROM CLIENT WHERE CLIENTID = @CLIENTiD), but each function returns one single column from the stored procedure.
Basically what I want is just one function that connects to the one stored procedure and it would be possible to get any one of the 30 columns (well the data for one row) out of the function. I thought perhaps a DataTable would be the best bet, which would return just one row, then I could say something like DataTable.ClientName or DataTable.ClientAddressLine1 etc etc.
Could anyone help with this. Or perhaps there's a better way of doing it. It would be good if you could show me how to do this with a stored procedure as I've really done very little with DataTables/TableAdaptors.
Many thanks in advance.
Dave
I've started working on an application that is not class based and making it class based at this stage in development would be too much work. The good thing about classes is that you can get all the details for a single row from a particular table (e.g. SELECT * FROM CLIENT WHERE CLIENTID = @CLIENTiD). Then you can get any value of the class by doing something like me.txtName.text = ClassClient.FullName
Anyway if you can imagine our client table has about 30 fields in it. So we could technically have 30 different functions (where each function calls the same stored procedure e.g. SELECT * FROM CLIENT WHERE CLIENTID = @CLIENTiD), but each function returns one single column from the stored procedure.
Basically what I want is just one function that connects to the one stored procedure and it would be possible to get any one of the 30 columns (well the data for one row) out of the function. I thought perhaps a DataTable would be the best bet, which would return just one row, then I could say something like DataTable.ClientName or DataTable.ClientAddressLine1 etc etc.
Could anyone help with this. Or perhaps there's a better way of doing it. It would be good if you could show me how to do this with a stored procedure as I've really done very little with DataTables/TableAdaptors.
Many thanks in advance.
Dave