|
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 |
|
|
|
|
|
|
|
vb6 ker vb.net?
bagi coding... |
|
|
|
|
|
|
|
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 |
|
|
|
|
|
|
|
tahu kat mana salahnya.. tapi tak tahu cara menjawabnye |
|
|
|
|
|
|
|
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...
- dim sql as string= "select idno from tableA where empsection = 'ICT'"
- dbConn.open
- myDataAdapter = New MySqlDataAdapter(sql, myConnection)
- myDataSet = New DataSet
- myDataAdapter.Fill(myDataSet, "Reference")
- DataGrid1.DataSource = myDataSet
- DataGrid1.DataBind()
Copy the Code
field apa yg nak view kita set kat datagrid.. try la dulu.. |
|
|
|
|
|
|
|
terima kasih
tapi masih tak berjaya
record yang dibaca masih lagi record terakhir
mungkin aku patut cuba repeater tak? |
|
|
|
|
|
|
| |
|