|
Philosophical take on how to fetch a data structure from SQL Server 2000: msg#00020org.user-groups.dotnet.padnug
What is your philosophical take on how to fetch a data structure? What I have working is: 1) Create a DAL Service that uses the IDE GUI data controls SqlDataAdapter, SqlConnection, and then have it generate a DataSet. Then I write this function that returns just the structure of the DataTable. Public Function GetAddressStructure() As DataTable 'Gets the Structure without data for the Address Table Dim dt As New DataTable Dim ds As New DataSet ds = Me.DsAddresses1.Clone dt = ds.Tables(0) Return dt End Function 2) Now the guys here want me to move code in Stored Procedures for database access, however this aspect of grabbing the Data Structure, is somewhat in a gray area in between is it not? Or is there a way using Stored Procedures to just grab the Data Structure. 3) Reason for grabbing the Data Structure is to build a DataRow to build a SqlParameter array to pass into the Stored Procedures. Public Function ConvertClassToDataRow(ByVal pAddr As clsLocation) As DataRow 'converts the class into a dataRow Dim dt As New DataTable dt = myAddr.GetAddressStructure Dim newRow As DataRow = dt.NewRow() With pAddr newRow("AddressLine1") = .Addr1 newRow("AddressLine2") = .Addr2 newRow("City") = .City newRow("State") = .State newRow("ZipCode") = .Zip End With Return newRow End Function 4) Works really fine. Anyone have any better coding practices in doing this? Thought about copying the generated DataSet.xsd & it's code behind page into a separate solution, then testing if I can do the same thing...then philosophically being able to tweak the xsd manually later if the database changes... What do you think? ===== Elizabeth Gee Information Architect http://www.nwtd.com |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Adding controls to toolbox at install time: 00020, Justin Collum |
|---|---|
| Next by Date: | Re: is program running?: 00020, Nick Hebb |
| Previous by Thread: | Re: Adding controls to toolbox at install timei: 00020, Justin Collum |
| Next by Thread: | Re: Philosophical take on how to fetch a data structure from SQL Server 2000: 00020, Craig Wagner |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |