Hello,
I have a Data Grid view with Columns, i want the column UProertyNo to have a default value from a text box.
I'm showing the UPropertyNo Column to enter the data manually, but actually i want to hide it and insert in it the data which is in a text box.
My code for getting data to data grid view is:
Code:Try sqL = "SELECT UProertyNo, UNo, UType, UFloor, UCapacity,USala, URooms,UKitchens, UBaths, UMonthlyRent, UArea, UElectricity, UWater, UMaintenance FROM UnitMainFile WHERE UProertyNo = '" & txt_PropertyNo.Text & "'" ConnDB() cmd = New SqlCommand(sqL, conn) da = New SqlDataAdapter(cmd) ds = New DataSet() da.Fill(ds, "UnitMainFileMainFile") dgv_PropertyFlatsDetails.DataSource = ds.Tables("UnitMainFileMainFile").DefaultView dgv_PropertyMainFile.Rows(dgv_PropertyFlatsDetails.RowCount - 1).DefaultCellStyle.ForeColor = Color.Red conn.Close() Catch ex As Exception MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try
And my Code for updating the data grid view is:
Thanks in advance.Code:cmdbl = New SqlCommandBuilder(da) da.Update(ds, "UnitMainFileMainFile") MessageBox.Show("Done")




Reply With Quote
