c# - SQL Command Builder Query values -
I have a SQLDataAdapter, in my query I'm bringing two fields, id (PK), name.
I have registered a SQL command builder in my data adapter so I do not have to write the questions in the database to update the table.
When I The problem now is that I do not want to reveal this field in my Gird, when I set my visual property to false, the command builder quits this column in the query to complete this issue I have to set the column width to 0, but there is still a small line in my grid. Is there a better way to handle this situation? Except that I manually write questions. Below is the code to prepare the grid; and here is the code behind the updated button: This is a problem with AutoGeneratedCommands You can adopt any of the following: Modify the column digenidoid to accept zero values; Write your own updated SP in the database and register it as UpdateCommand with your data adapter. It is expected that you will show the path. da.update () method, SQL throws an error, due to this error, I can not insert a tap into the AYNID ID, Also, I have filled this field with a proper value in the grid. Then
da.update () worked.
Private zeros fmAttributes_Load (Object Sender, EventArgs e) {ds.Tables.Add ("Attributes"); SqlCommand CMD = new SQL Commands (); Cmd.Connection = New SqlConnection (Configuration Manager. Connection Strings ["Connection String"]. ConnectionString); Cmd.CommandText = "Select ID, Attribute, Code, DimensionAttribute from Dimension where dimensionid =" + selectedAttribute; Da.SelectCommand = cmd; Cb.DataAdapter = da; Da.Fill (DS, "attribute"); This.dgvAttributes.DataSource = ds.Tables ["Properties"]; This.dgvAttributes.Column ["id"] Visible = false; This.dgvAttributes.Column ["DimensionID"]. Width = 0; }
Private zeros btnOk_Click (Object Sender, EventArgs e) {if (ds.HasChanges () ) {DialogResult D = New DialogResult (); D = Message Box. Show ("Are you sure you want to save changes to database?", This text, message box. Yes No, Message box icon. If (D == DialogResult.Yes) {try_ fillDimensionID (); Da.UpdateCommand = cb.GetUpdateCommand (); Da.InsertCommand = cb.GetInsertCommand (); Da.DeleteCommand = cb.GetDeleteCommand (); Da.Update (DS, "attribute"); This.DialogResult = DialogResult.OK; This.Close (); } Hold (exception) {throw; }} And {return; }}}}
Comments
Post a Comment