MaxRows
How do I use Max Rows
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
Line | Code | Ex.. |
---|---|---|
317 | MaxRows = dsgrade.Tables["grade1"].Rows.Count; | 1 |
334 | if (inc != MaxRows - 1) | 2 |
195 | int MaxRows; | 3 |
235 | int MaxRows; | 4 |
File name: Form1.cs
Copy
314 public void LAST_Click(System.Object sender, System.EventArgs e)
315 {
316 dsgrade = gradeclass.DataModule.navigate();
317 MaxRows = dsgrade.Tables["grade1"].Rows.Count;
318 if (inc != MaxRows)
319 {
320 inc = MaxRows - 1;
321 NavRecords();
322 }
323 else
324 {
325 MessageBox.Show("Last Record");
326 }
327 }
File name: Form1.cs
Copy
329 public void NXT_Click(System.Object sender, System.EventArgs e)
330 {
331 dsgrade = gradeclass.DataModule.navigate();
332 try
333 {
334 if (inc != MaxRows - 1)
335 {
336 inc++;
337 NavRecords();
338 }
339 }
340 catch (Exception)
341 {
342 MessageBox.Show("No More Rows");
343 }
344 }
File name: gradeclass.cs
Copy
185 public DataSet navigate(string sortfield)
186 {
187
188 System.Data.OleDb.OleDbConnection conn = GetConnection();
189 DataSet ds = new DataSet();
190
191 try
192 {
193
194 int inc;
195 int MaxRows;
196
197 string sql = "select * from table1";
198 System.Data.OleDb.OleDbDataAdapter da = new System.Data.OleDb.OleDbDataAdapter(sql, conn);
199
200 try
201 {
202 da.Fill(ds, "grade1");
203 MaxRows = ds.Tables["grade1"].Rows.Count;
204 inc = -1;
205
206
207 }
208 finally
209 {
210 da.Dispose();
211 }
212
213 return ds;
214 }
215 finally
216 {
217 conn.Close();
218 conn.Dispose();
219 }
220 }
File name: gradeclass.cs
Copy
225 public DataSet deldata(string sortfield)
226 {
227
228 System.Data.OleDb.OleDbConnection conn = GetConnection();
229 DataSet ds = new DataSet();
230
231 try
232 {
233
234 int inc;
235 int MaxRows;
236
237 //Dim sql As String = "select * from table1"
238 //Dim da As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter(sql, conn)
239
240 try
241 {
242
243 string sqldelete = default(string);
244 sqldelete = "DELETE * FROM table1 WHERE STUDENTID=\'" + Form1.Default.STUDID.Text + "\'";
245 System.Data.OleDb.OleDbDataAdapter da = new System.Data.OleDb.OleDbDataAdapter(sqldelete, conn);
246
247 // Gets the records from the table and fills our adapter with those.
248 DataTable dt = new DataTable("grade1");
249 da.Fill(dt);
250 MessageBox.Show("Data has been deleted");
251 clearall();
252
253 Form1.Default.DataGridView1.DataSource = dt;
254
255 RefreshDGV();
256
257 }
258 finally
259 {
260 //da.Dispose()
261 }
262
263 return ds;
264 }
265 finally
266 {
267 conn.Close();
268 conn.Dispose();
269 }
270 }
MaxRows 122 lượt xem
Gõ tìm kiếm nhanh...