Hi
I am receiving an error message
"Error 1 'System.Data.DataRow.DataRow(System.Data.DataRowBuilder)' is inaccessible due to its protection level ",when i try to update the database programtically through datagridview control placed in my from.
I want to edit and update a database at run time while changing the corresponding cell values of my datagridview control.
Please,provide me the appropriate code snippet with a brief note....

Updating Database
reZer
Because this class doesn't have a public constructor i geus you get this compile error because it can't find a public constructor that match your overload.
yennisse
hi sande,
I I just tried out your's. but,it seems not working .Can you give a clear note out of it..I just want to edit my datagridview cell values and update the corresponding database.
Hayder Marzouk
Aaron Steers
Try http://www.syncfusion.com/FAQ/WindowsForms/
jswilson
To add a row to your datatable use:
DataTable myTable = GetDate( c, b );
DataRow row = myTable.NewRow();
sp_412000
hi,
the following is the code....
DataRow
myDataRow = new DataRow();// I am getting error at this line.....private
void button4_Click(object sender, EventArgs e){
try{
DataSet myDataSet = new DataSet(); string a = textBox2.Text; object b = comboBox1.SelectedItem; string c = richTextBox1.SelectedText;bindingSource1.DataSource = GetData(c, b);
dataGridView1.Visible =
true; this.dataGridView1.DataSource = bindingSource1; this.dataGridView1.AutoResizeColumns( DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader); int aa = dataGridView1.RowCount;label10.Visible =
true;label11.Visible =
true; this.dataGridView1.SelectAll();textBox1 .Visible =
true ;textBox1.Text = aa +
" row(s) affected";label10.Text =
"Query Execueted Successfully";myDataRow.AcceptChanges();
dataGridView1.Update();
}
catch (Exception ee){
//MessageBox.Show(ee.Message, "Current Error Message");label10.Text = ee.Message;
textBox1.Text =
"";dataGridView1.Visible =
false;label11.Visible =
false;}
}
public
static DataTable GetData(string selectCommand, object dat){
string connectionString = "Integrated Security=SSPI;Persist Security Info=False;" + "Initial Catalog=" + dat + ";Data Source=microsoft\\raj;Packet Size=4096"; // Connect to the database and fill a data table. SqlDataAdapter adapter = new SqlDataAdapter(selectCommand, connectionString); DataTable data = new DataTable();data.Locale = System.Globalization.
CultureInfo.InvariantCulture;adapter.Fill(data);
return data;}
Fab IT
hi,
could you help me with that code....