Question subject: How do I connect my form tomy database
Posted: Wed May 27, 2009 9:39 am
Joined: Wed May 27, 2009 9:06 am Posts: 2 Has thanked: 0 time Have thanks: 0 time
Hello, Please am new on C# and am using Ms Visuall studio 2008 to build a windows form using C# but I dont know how to connect my submit button to the database ms sql server 2005, so i can view the information entered from the form. Thank you
yosiffz
Question subject: Re: How do I connect my form tomy database
Posted: Sun Oct 24, 2010 4:38 am
Joined: Tue Mar 30, 2010 4:17 pm Posts: 3 Has thanked: 0 time Have thanks: 1 time
using System.Data.SqlClient;
String sqlQuery = "INSERT INTO table name Values (@,@,@,@,@,@)"; SqlConnection aConn = new SqlConnection("Data source= Your Computer name \\SQLEXPRESS; database= your database name ; Integrated Security = true"); SqlCommand aCommand = new SqlCommand(sqlQuery, aConn);
Regards Joe
For this message the author yosiffz has received gratitude : msi_333