SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


The absolute basics of coding SQL Server in VB.net


The absolute basics of coding SQL Server in VB.net

Author
Message
gary.p.heath
gary.p.heath
Valued Member
Valued Member (56 reputation)Valued Member (56 reputation)Valued Member (56 reputation)Valued Member (56 reputation)Valued Member (56 reputation)Valued Member (56 reputation)Valued Member (56 reputation)Valued Member (56 reputation)

Group: General Forum Members
Points: 56 Visits: 56
I am trying my best to get my head around SQL Server but seem to be going around in circles. Everything I google is either way too complicated for my simple means or else I find half a dozen different ways to do the same thing.

Can somebody please point me to a site, an article or a video where, in clear, plain, simple English, it explains the differences and the relationships between a datatable, a dataset, a dataadapter, a datastream & various other options I keep getting presented with ?!?

The sooner I can grasp the concepts and the differences, the sooner I can spend my time actually coding rather than asking questions ;-) !!!
marcel.eppel
marcel.eppel
SSC Rookie
SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)

Group: General Forum Members
Points: 35 Visits: 50
This topic is .NET related since the only differences here are based on the processing of the query results. You should choose a simple method to get data back from sql server and get starting processing teh data. An easy way which is well described in millions of tutorials is using the technique with SqlDataAdapter, SqlCommand, SqlConnection and Datatables.

When the query returns a scalar result, most of this logic is not even needed because you can execute the query with an SqlCommand.ExecuteScalar() method and implicitly cast the result to the correct datatype. (int dbid = (int)cmd.ExecuteScalar()Wink

You can find more information on the various classes by googling "MSDN .net datatable" etc.
Lowell
Lowell
One Orange Chip
One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)

Group: General Forum Members
Points: 27978 Visits: 39922
gary.p.heath (3/6/2013)
I am trying my best to get my head around SQL Server but seem to be going around in circles. Everything I google is either way too complicated for my simple means or else I find half a dozen different ways to do the same thing.

Can somebody please point me to a site, an article or a video where, in clear, plain, simple English, it explains the differences and the relationships between a datatable, a dataset, a dataadapter, a datastream & various other options I keep getting presented with ?!?

The sooner I can grasp the concepts and the differences, the sooner I can spend my time actually coding rather than asking questions ;-) !!!


a DataTable is a an object that mirrors a Table in SQL Server. it can have primary key, unique constraints, not null constraints, size constraints, defaults for columns, and even references(ie FK) to other Datatable.Columns. You would populate it with a query, so it is the object you use as a
container for the results of a query...so that query could be capturing the results from a table, query or view.

a dataSet is a container which can have zero to many DataTables. The image below is a Dataset with six DataTables in it.

A dataAdapter is the .NET object what is used to process the query from the server, and stuff it into the table. it is also used to sned any changes in the DataSet you've made, to propagate those changes back to the SQL Server.

A datastream is what is used when one of the columns in your datatable is binary(image, varbinary for example); it's just handling the results in a special way, is how i would explain it.

you can create a Dataset.xsd in your project, and with the server explorer, drag and drop tables you plan to use in your query. this can help during design time.



Lowell

--
help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

gary.p.heath
gary.p.heath
Valued Member
Valued Member (56 reputation)Valued Member (56 reputation)Valued Member (56 reputation)Valued Member (56 reputation)Valued Member (56 reputation)Valued Member (56 reputation)Valued Member (56 reputation)Valued Member (56 reputation)

Group: General Forum Members
Points: 56 Visits: 56
Lowell, thank you, that's a great help ...
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search