I've written a short tutorial how to get started writing sql database applications with C#. The totorial is in PDF format so that you can download it and read at your leasure. It assumes you are using MS-Windows and Visual Studio 2012. If you are using an earlier version of VS then screenshots may be slightly different that those shown in the tutorial. I also assume you already know C# language and can read the code/understand the code. Below is the code. I posted it here without comment because it's explained in the tutorial. The same code is in the tutorial but MS-Word 2010 only inserted a screen shot of it, making it somewhat difficult to read.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace MyDVDCollection1
    public partial class Form1 : Form
        public Form1()

        private void Form1_Load(object sender, EventArgs e)
            // TODO: This line of code loads data into the 'dvd_collectionDataSet.movies' table. You can move, or remove it, as needed.
//            this.moviesTableAdapter.Fill(this.dvd_collectionDataSet.movies);


        private void btnSave_Click(object sender, EventArgs e)

        private void btnRefresh_Click(object sender, EventArgs e)


        private void btnClear_Click(object sender, EventArgs e)
            // Remove all selected rows from the Grid
            Int32 selectedRowCount =
            if (selectedRowCount > 0)

                for (int i = 0; i < selectedRowCount; i++)

Recommended Answers

that s great, thanks!

Jump to Post

All 6 Replies

that s great, thanks!

hello together,
i have a question.
- 1 - i have a sql-server-database, and some sql-server-user.
- 2 - i'm writting a C#-app to manage the data in the database.
- 3 - now the question, how should i implement the user authentication????
should i create for every user an account on sql-server, or should i create a db-table-user, and how does the solution affect the security of the database???
with the user-table-solution, should the parameter od the server-connection-string "integrated security = true"??
some help please
what is pro, and what s contra?

I have always created user accounts on the sql-server. When the connection is made the connection string needs to include the user name and password. You can write C# program to create users in the sql-server but you program will ultimately have to send the CREATE USER sql string.

thanks for replying, i start to believe thats the best way to do that, denn there will be no user-registration done in the app.

can the password be incrypted or something like that?

To my knowledge passwords must be plain text in the sql statement. But I'm not a DBA, they may know a way to teach the sql server how to unencrypt the password.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.