Learning Datasets...
-
If someone has a better idea in how I can do this please let me know. Normally I what I would do is call sqlreader and each field I would put into a custom array to use through out the application. Well now that I have learned how to create a dataset, while in code without using the vs customized dataset's interface...
string connectionString = TheSQLConnectionString.ConnectionString.ToString();
//DataSet dtSet = new DataSet();
//SqlConnection connection;
using (connection = CreateConn())
{
command = new SqlCommand(TheSQLCommand, connection);
SqlDataAdapter adapter = new SqlDataAdapter(command);
adapter.Fill(dtSet);
}Now what I want to be able to do is take the (dtSet) dataset and in code read each row and each row's columns of data. However I want to place this code in a class Passing the parameters (table, row, and column) and I want the class procedure to return the value. Can someone point me in the right direction please in how to understand datasets in order to accomplish this? Thanks in advance.
-
If someone has a better idea in how I can do this please let me know. Normally I what I would do is call sqlreader and each field I would put into a custom array to use through out the application. Well now that I have learned how to create a dataset, while in code without using the vs customized dataset's interface...
string connectionString = TheSQLConnectionString.ConnectionString.ToString();
//DataSet dtSet = new DataSet();
//SqlConnection connection;
using (connection = CreateConn())
{
command = new SqlCommand(TheSQLCommand, connection);
SqlDataAdapter adapter = new SqlDataAdapter(command);
adapter.Fill(dtSet);
}Now what I want to be able to do is take the (dtSet) dataset and in code read each row and each row's columns of data. However I want to place this code in a class Passing the parameters (table, row, and column) and I want the class procedure to return the value. Can someone point me in the right direction please in how to understand datasets in order to accomplish this? Thanks in advance.
If you don't actually want the DataSet, then don't create the DataSet. I prefer to just use a DataReader and directly populate the classes I intend to use. DataAdapters, DataSets, and DataGrid(View)s weren't created for actual real-world use -- their only purpose is allow MS demonstrators to quickly create barely-useful applications to make easily-impressed audiences go "ooohhh".
-
If you don't actually want the DataSet, then don't create the DataSet. I prefer to just use a DataReader and directly populate the classes I intend to use. DataAdapters, DataSets, and DataGrid(View)s weren't created for actual real-world use -- their only purpose is allow MS demonstrators to quickly create barely-useful applications to make easily-impressed audiences go "ooohhh".
PIEBALDconsult wrote:
DataAdapters, DataSets, and DataGrid(View)s weren't created for actual real-world use -- their only purpose is allow MS demonstrators to quickly create barely-useful applications to make easily-impressed audiences go "ooohhh".
:thumbsup: 10+
I bug
-
If you don't actually want the DataSet, then don't create the DataSet. I prefer to just use a DataReader and directly populate the classes I intend to use. DataAdapters, DataSets, and DataGrid(View)s weren't created for actual real-world use -- their only purpose is allow MS demonstrators to quickly create barely-useful applications to make easily-impressed audiences go "ooohhh".
Motion Seconded, on all points.
ragnaroknrol The Internet is For Porn[^]
Pete o'Hanlon: If it wasn't insulting tools, I'd say you were dumber than a bag of spanners. -
If you don't actually want the DataSet, then don't create the DataSet. I prefer to just use a DataReader and directly populate the classes I intend to use. DataAdapters, DataSets, and DataGrid(View)s weren't created for actual real-world use -- their only purpose is allow MS demonstrators to quickly create barely-useful applications to make easily-impressed audiences go "ooohhh".
Cynical, definately cynical.
Never underestimate the power of human stupidity RAH
-
PIEBALDconsult wrote:
DataAdapters, DataSets, and DataGrid(View)s weren't created for actual real-world use -- their only purpose is allow MS demonstrators to quickly create barely-useful applications to make easily-impressed audiences go "ooohhh".
:thumbsup: 10+
I bug
Ok how do you recommend getting the data from sql server database into the application if you do not recommend the use of datasets?
-
Ok how do you recommend getting the data from sql server database into the application if you do not recommend the use of datasets?
that question has been answered here already. :|
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
-
Cynical, definately cynical.
Never underestimate the power of human stupidity RAH
And experienced as well.