a insert in to sql is keep changing in datagrid display. But its not appearing fully. example i have got four column in this table. While run first time its displaying 4 columns data. But while i inserting the data in to table then two column data only its coming.
Column1,Column 4 is not appearing in datagridview while button click . please note that. Column 1(ID) auto-increment and Column(time) is autotimestamp. my sql code is
What I have tried:
SE [d]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[data](
[ID] [int] IDENTITY(1,1) NOT NULL,
[no] [nvarchar](255) NULL,
[name] [nvarchar](255) NULL,
[time] [datetime] NULL,
PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
VB CODE
protected void button1_Click_1(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection();
con.ConnectionString = ("Data Source=PC;Initial Catalog=d;Integrated Security=True");
con.Open();
String st = "INSERT INTO data(no,name,time)values (@no, @name, GETDATE())";
SqlCommand cmd = new SqlCommand(st, con);
cmd.Parameters.AddWithValue("@no", textBox5.Text);
cmd.Parameters.AddWithValue("@name", textBox6.Text);
cmd.ExecuteNonQuery();
MessageBox.Show("Saved");
con.Close();
textBox5.Text = "";
textBox6.Text = "";
dataBindingSource5.DataSource = dataTableAdapter.GetData();
dataBindingSource5.ResetBindings(false);
//// dataGridView2.Refresh();
}