c# Using Parameters.AddWithValue in SqlDataAdapter

The string used to initialize the SqlDataAdapter becomes the value for the CommandText property inside the SelectCommand property of the SqlDataAdapter. You could add parameters to that command with this code da = new SqlDataAdapter(“SELECT * FROM annotations WHERE annotation LIKE @search”, _mssqlCon.connection); da.SelectCommand.Parameters.AddWithValue(“@search”,”%” + txtSearch.Text + “%”); First, remove the single quotes around the … Read more

ReadOnlyException DataTable DataRow “Column X is read only.”

using DataAdapter.Fill does not load the database schema, which includes whether a column is a primary key or not, and whether a column is read-only or not. To load the database schema, use DataAdapter.FillSchema, but then that’s not your questions. using DataReader to fill a table loads the schema. So, the index column is read-only … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)