hello everyone. I'm new in c# ...
i have a form with 3 textboxs (name,age,phone) and a button (insert record).
what i would like to do is to write something in the textbox and then insert that info into the db...
can someone give me some help....
thanks in advance..
Loading
trkpowerPosted Apr 9, 2008, 12:49 PM
Ryan AlfordPosted Apr 9, 2008, 9:42 AM
http://www.c-sharpcorner.com/Articles/ArticleListing.aspx?SectionID=1&SubSectionID=131
http://www.codebeach.com/index.asp?tabID=2&categoryID=15&subcategoryID=3
http://www.developersdex.com/csharp/default.asp?p=1886
Bechir BejaouiPosted Apr 8, 2008, 11:01 AM
The Oledb library for oracle, access and others
The Sql library for only Sql data base only, most people work with Sql server in a .Net context because it is very performant than others, but as beginner I advise you begin with access data dinding as the first step
I give you an example:
lets assume that we have a data to insert in a given data base
first you have to include the namespace by writing at the top of the code
using System.Data.OleDB;
then
OleDbConnection oConnection;
OleDbCommand oCommand;
int rowAffected;
oConnection = new Connection(@"Provider=Microsoft.Jet.OLEDB.4.0; Data Source= put the access data base path here");
oCommand = new OleDbCommand("INSERT INTO [yourTableName] (Field) VALUES(" + yourtext.Text + " WHERE [your condition here]", oConnection);
oConnection.Open();
{
rowAffected = oCommand.ExcuteNonQuery();
}
Finally
{
connection.Close();
}