My Blog

My thoughts on it all

Newbie Question VB.net and XML

Nov 6, 2003 / 13 Replies Hello all!

I am a friend of Aesopian and dcormier. I am currently taking VB.net II at the spc clw campus. We just finished working with SQL and OLEDB and such for our projects. I had a bit of a hard time getting SQL to run on my machine but it works now. I am running XP home ed.

So here is my question, actually I have two...
1) When I am using Visual Studio 2003, I can browse my server explorer and see the SQL server and the four "databases" that come with it, but are totally blank. How do I create databases that I can use and view from that list? (this is where our instructor had use create data adapters from and, of course, connections to the datasource)

2) I want to access an XML file that has data already in the elements and use the file like a pseudo-database. I read the help that microsoft provided and this is what I have so far.
Dim dsChars1XML As New DataSet("xmlsheet")

Private Sub btnRead_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRead.Click

Dim filePath As String
filePath = "C:\xmltemp\xmldatabase.xml"
With dgrStuff
.DataSource = dsChars1XML
.DataMember = "mySheet"
.CaptionText = .DataMember
End Sub

So that displays the first table in the XML database I have, And it gives me the data that is in the respective elements of that table.

Now how do I go about getting just one piece of information(not a whole table, just one of the elements) and displaying it in a textbox or label.

If someone knows how to create a connection to the XML file and then a data adapter, then I would know how to do the rest. But since everything I have tried in the server explorer doesn't allow me to connect to and XML file... I am stumped.