[dba-VS] Trying to Pull Data from a Local Database via C# code
bill_patten at embarqmail.com
Fri Sep 18 12:03:18 CDT 2015
Try a Google search like this "building your first database app in C#"
Lots of choices like this:
Then pick the one or those that look similar to what you would like to do.
Many have down loadable solutions that could help you.
From: Brad Marks
Sent: Thursday, September 17, 2015 7:14 PM
To: Development in Visual Studio
Subject: [dba-VS] Trying to Pull Data from a Local Database via C# code
I am new to Visual Studio and C#.
Recently, I have been experimenting with several small C# programs to better
understand C# and to document how to do various tasks.
Earlier this week, I used Visual Studio (2013) to set up a small test Local
database (via Visual Studio facilities) and populate it with a few rows of
Here is what I did…
Added a new Item “Service-Based Database” named Test1.mdf
Used “Data Sources” to add a new Data Source
Via the Visual Studio “Server Explorer”, I added a new table called tlbTest1
with just one column named “Field1”
Used “Show Table Data” to view the new table and then added a small number
Used “Data Sources” to add a new data source, checked tblTest1 and then
dragged this new table to a small Form.
I was then able to view (on the form) the rows that I had added earlier.
So far, things worked nicely. I was able to establish a new local database,
set up a new table, add data to this table, and then view this data via a
Next, I want to figure out how to retrieve the data via C# code. I have
found quite a bit of information on the internet and I have made many
attempts, but no success.
After spending an entire day on this issue, I decided to ask the following
Does anyone have a simple example of how to pull data from a local database
with C# code?
I believe that I have the connection string correct, as it appears that the
“connect” statement seems to be working.
dba-VS mailing list
dba-VS at databaseadvisors.com
More information about the dba-VS