Hello guys,
i dont have any experience in .net development.
i already downloaded ebooks but most ebooks using old visual studio.
so i cant follow every step in the ebooks and got confused.
im using visual studio 2008.
ok,i need to create a simple program that has a database.
i used sample northwind database.
at the form,there is one text box and one button.
i already add the datasource which is pointing to northwind database
now,what i want to do is very simple.
let say user input anything in the text box and click the button.then the program will execute sql command to insert the data into database.
the problem is,the data doesnt insert into the database.
this is my code :
CODE
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace WindowsFormsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
String cid = textBox1.Text;
SqlCommand command = new SqlCommand("INSERT INTO Customers ([Customer ID]) VALUES (cid)");
MessageBox.Show("DONE!");
}
}
}