I have created sime form in which name and surname text box are there and save button i want to save name and surname in table but it is not possible no error is showing and displaying that data inserted successfully but data in table is null
my code is
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;
using System.Configuration;
namespace WindowsFormDemo
{
public partial class Form1 : Form
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
string qry;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
con.Open();
qry = "INSERT INTO Info VALUES ('" + textBox1.Text + "','" + textBox2.Text + "')";
SqlCommand cmd = new SqlCommand(qry, con);
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show("Inserted sucessfully");
textBox1.Text = "";
textBox2.Text = "";
}
}
}
please help me with this ............