Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Display a on the datagrid [modified]

Display a on the datagrid [modified]

Scheduled Pinned Locked Moved C#
saleshelp
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mamphekgo
    wrote on last edited by
    #1

    Hi.i did a project a that records a transactions that customer make daily something like Bank,so i want to display only transactions that were made by a specific customer using his account number on the datagrid.the problem is it doesn't display the record i that requested it to display only so i did something like this. public bool DisplayTrans(string CBarcode2) { try { conn1= new SqlConnection(ConString); cmdDisplay1= new SqlCommand(); daDisplay = new SqlDataAdapter(); dsDisplay = new DataSet(); cmdDisplay1.Connection = conn1; daDisplay.SelectCommand = cmdDisplay1; cmdDisplay1.CommandText = "SELECT CustomerName,ProductName,Price,EventName,BoughtDate,BoughtTime FROM Transactions WHERE Barcode2 =@Barcode2 "; SqlParameter Bar = new SqlParameter(); Bar.ParameterName = "@Barcode2"; Bar.Direction = System.Data.ParameterDirection.Input; Bar.Value = CBarcode2; cmdDisplay1.Parameters.Add(Bar); daDisplay.Fill(dsDisplay,"Transactions"); } catch(Exception ex) { MessageBox.Show(ex.Message); return false; } return true; -- modified at 5:31 Thursday 24th August, 2006

    C 1 Reply Last reply
    0
    • M Mamphekgo

      Hi.i did a project a that records a transactions that customer make daily something like Bank,so i want to display only transactions that were made by a specific customer using his account number on the datagrid.the problem is it doesn't display the record i that requested it to display only so i did something like this. public bool DisplayTrans(string CBarcode2) { try { conn1= new SqlConnection(ConString); cmdDisplay1= new SqlCommand(); daDisplay = new SqlDataAdapter(); dsDisplay = new DataSet(); cmdDisplay1.Connection = conn1; daDisplay.SelectCommand = cmdDisplay1; cmdDisplay1.CommandText = "SELECT CustomerName,ProductName,Price,EventName,BoughtDate,BoughtTime FROM Transactions WHERE Barcode2 =@Barcode2 "; SqlParameter Bar = new SqlParameter(); Bar.ParameterName = "@Barcode2"; Bar.Direction = System.Data.ParameterDirection.Input; Bar.Value = CBarcode2; cmdDisplay1.Parameters.Add(Bar); daDisplay.Fill(dsDisplay,"Transactions"); } catch(Exception ex) { MessageBox.Show(ex.Message); return false; } return true; -- modified at 5:31 Thursday 24th August, 2006

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      I assume that you have a problem with this code, and you're not just sharing it for fun ?

      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

      N 1 Reply Last reply
      0
      • C Christian Graus

        I assume that you have a problem with this code, and you're not just sharing it for fun ?

        Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

        N Offline
        N Offline
        Not Active
        wrote on last edited by
        #3

        Actually this is quite useful. I've been awake all night try to figure out how to how query the database and fill a dataset. I could have gotten more sleep if I'd have only waited for this post. :doh: ;P

        only two letters away from being an asset

        M 1 Reply Last reply
        0
        • N Not Active

          Actually this is quite useful. I've been awake all night try to figure out how to how query the database and fill a dataset. I could have gotten more sleep if I'd have only waited for this post. :doh: ;P

          only two letters away from being an asset

          M Offline
          M Offline
          Muammar
          wrote on last edited by
          #4

          hey, try this link Using DataGrid

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups