CariDotMy

 Forgot password?
 Register

ADVERTISEMENT

View: 2036|Reply: 5

datagrid

[Copy link]
Post time 9-8-2007 04:10 PM | Show all posts |Read mode
to all expert
camana nak add data dalam datagrid.
aku ada dua record. record 12 dan record 13.
setiap kali aku buat looping untuk display data, hanya record 13 saya yang display. record 12 tak. maksudnya dia ambil record terakhir utk papar. aku nak dia papar record 12 dan record 13.

terima kasih
Reply

Use magic Report


ADVERTISEMENT


Post time 9-8-2007 04:26 PM | Show all posts
vb6 ker vb.net?
bagi coding...
Reply

Use magic Report

 Author| Post time 9-8-2007 04:49 PM | Show all posts
vb.net

dim sql as string= "select idno from tableA where empsection = 'ICT'"
Dim cmd As New OleDb.OleDbCommand(sql, dbconn)
        dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)

        Do While dr.Read()

               dbconn1.Open()
            MyCommand = New OleDbCommand("Storeprod1", dbconn1)
            MyDataAdapter = New OleDbDataAdapter(MyCommand)
            MyDataAdapter.SelectCommand.CommandType = CommandType.StoredProcedure
            MyDataAdapter.SelectCommand.Parameters.Add("@id", dr.Item(0))

            DataGrid1.DataSource = MyCommand.ExecuteReader(CommandBehavior.CloseConnection)
            DataGrid1.DataBind()
            dbconn1.Close()
        Loop
Reply

Use magic Report

Post time 9-8-2007 07:57 PM | Show all posts
tahu kat mana salahnya.. tapi tak tahu cara menjawabnye
Reply

Use magic Report

Post time 10-8-2007 08:19 AM | Show all posts
Originally posted by yIEn at 9-8-2007 04:49 PM
dim sql as string= "select idno from tableA where empsection = 'ICT'"
Dim cmd As New OleDb.OleDbCommand(sql, dbconn)
        dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)

        Do While dr.Read()

               dbconn1.Open()
            MyCommand = New OleDbCommand("Storeprod1", dbconn1)
            MyDataAdapter = New OleDbDataAdapter(MyCommand)
            MyDataAdapter.SelectCommand.CommandType = CommandType.StoredProcedure
            MyDataAdapter.SelectCommand.Parameters.Add("@id", dr.Item(0))

            DataGrid1.DataSource = MyCommand.ExecuteReader(CommandBehavior.CloseConnection)
            DataGrid1.DataBind()
            dbconn1.Close()
        Loop



aku buat gini selalunya...


  1. dim sql as string= "select idno from tableA where empsection = 'ICT'"
  2. dbConn.open
  3. myDataAdapter = New MySqlDataAdapter(sql, myConnection)
  4. myDataSet = New DataSet
  5. myDataAdapter.Fill(myDataSet, "Reference")
  6. DataGrid1.DataSource = myDataSet
  7. DataGrid1.DataBind()
Copy the Code


field apa yg nak view kita set kat datagrid.. try la dulu..
Reply

Use magic Report

 Author| Post time 10-8-2007 09:17 AM | Show all posts
terima kasih
tapi masih tak berjaya
record yang dibaca masih lagi record terakhir
mungkin aku patut cuba repeater tak?
Reply

Use magic Report

Follow Us
You have to log in before you can reply Login | Register

Points Rules

 

ADVERTISEMENT



 

ADVERTISEMENT


 


ADVERTISEMENT
Follow Us

ADVERTISEMENT


Mobile|Archiver|Mobile*default|About Us|CariDotMy

3-1-2025 01:11 AM GMT+8 , Processed in 0.045632 second(s), 19 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

Quick Reply To Top Return to the list