Hello, me and my programming group were given the task to build a program to save peoples information, for instance, Name, Last Name, Age, I.D., etc.

Is there a guide, A VERY BASIC GUIDE, to pass the values of, say, a text box to an SQL Database?

Or to make it easier for us, even save values as a string to a StreamWriter.

Recommended Answers

All 6 Replies

Sure comes as part of the F1 help key.

StreamWriter is in essence file IO. So that should not cause that much of a problem.
And a VERY BASIC GUIDE to SQL Database? If I had one I would give it. But you alwyas have to set up a connection, sqlcommands(insert,delete,update). It is helpfull if you know what a DataSet is, what a DataReader is etc. In short see what ADO.NET can do for you.

I'm already familiar with SQL query command in SQL Server 2008, it's just that I don't know how to intertwine both C# and my SQL database.

So, is there a guide that demonstrates this process?

Ever tried to drag a database table to an empty form? See what happens next!

As I said, your F1 key has all the answers, it has examples of connecting to SQL, as well as how to maniuplate data and queries.

Hello, me and my programming group were given the task to build a program to save peoples information, for instance, Name, Last Name, Age, I.D., etc.

Is there a guide, A VERY BASIC GUIDE, to pass the values of, say, a text box to an SQL Database?

Or to make it easier for us, even save values as a string to a StreamWriter.

You mean something like this:

string dbConn = ConfigurationSettings.AppSettings["DatabaseConn"];
OleDbConnection loginConn = new OleDbConnection(dbConn);
loginConn.Open();

OleDbCommand getOwnerQuery = new OleDbCommand("SELECT EMPNAME FROM EMPLOYEE WHERE EMPNO = '" + ownerEmpNo + "'", loginConn);
OleDbDataReader reader = getOwnerQuery.ExecuteReader();
while(reader.read())
{
     TextBox1.Text = reader["FieldName"].ToString();
}
reader.Close();
Be a part of the DaniWeb community

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