Hi there all, I am trying to get data from a sql view and bound it into the datagridview, after that, I add 4 more colums into the datagridview which are editable, finally pass the entered data into a new database and call that data in the future in the load of Datagridview... I have 19 colums return from view, 4 more colums I have added. Here is the code;
string[] kolon = { "Asd1", "Asd2", "Asd3", "Asd4" };
private void button1_Click(object sender, EventArgs e)
{
string ad;
SqlConnection conn = new SqlConnection("Server=.;Database=CrmDatabase;Trusted_Connection=True");
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
for (int j = 19 , h = 0; j < dataGridView1.Columns.Count; j++, h++)
{
if (!(dataGridView1.Rows[i].Cells[j].Value == null))
{
ad = dataGridView1.Rows[i].Cells[j].Value.ToString();
if (conn.State == System.Data.ConnectionState.Closed)
conn.Open();
SqlCommand komut = new SqlCommand("Insert into Raporlama(" + kolon[h] + ") values(" + ad + ")", conn);
listBox1.Items.Add("Insert into Raporlama(" + kolon[h] + ") values(" + ad + ")");
if (conn.State == System.Data.ConnectionState.Open)
conn.Close();
}
}
}
MessageBox.Show("kayıt tamam");
}
The problem is that no errors in C# but no data entered into Raporlama table, even no reach I suggest... Please send your precious helps... :(