423,832 Members | 1,902 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,832 IT Pros & Developers. It's quick & easy.

MS Access Query

P: 3
Hi!
I have an access database with forms. I created a query that would filter records between range.

I've already figured out how to filter the records using parameters.

how will i display the result from access without including the column names in my datagridview since it already has its own column name?

below is my code:

Expand|Select|Wrap|Line Numbers
  1. cn.Open()
  2.                 cmd = cn.CreateCommand
  3.                 cmd.CommandText = "SELECT TrainingType, Condensed FROM tblCTrainings WHERE @CJobLevel BETWEEN LowerBound AND UpperBound"
  4.                 cmd.Parameters.AddWithValue("@CJobLevel", .txtCJobLevel.Text)
  5.  
  6.                 Dim table As New DataTable("tblCTrainings")
  7.                 Dim da As New OleDbDataAdapter(cmd)
  8.                 da.Fill(table)
  9.                 .dgCTraining.DataSource = table
  10.  
  11.                 For Each dr As DataRow In dt.Rows
  12.                     .dgCTraining.Rows.Add()
  13.                     With frmPersonalTraining.dgCTraining.Rows(frmPersonalTraining.dgCTraining.Rows.Count - 1)
  14.                         .Cells("cTraining").Value = dr("TrainingType")
  15.                         .Cells("cCourse").Value = dr("Condensed")
  16.                     End With
  17.                 Next
  18.  
Mar 17 '17 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.