ผมใช้ gridcontrol ของ devexpress ขึ้นเตือน rows is not a member of devexpress.xtragrid.gridcontrol แต่ถ้าใช้ datagridview จะไม่เตือน error ต้องแก้ไงครับ
Private Sub nbi_disability_LinkClicked(sender As Object, e As DevExpress.XtraNavBar.NavBarLinkEventArgs) Handles nbi_disability.LinkClicked
Dim contxt As String = "c:\ProgramData\sn_tool.txt"
'อ่านค่าใน sn_tool.txt เพิ่อเอาค่ามาแสดงใน textbox
Dim line() As String = IO.File.ReadAllLines(contxt)
Dim host As String = line(0)
Dim user As String = line(1)
Dim pwd As String = line(2)
Dim db As String = line(3)
Dim con As MySqlConnection = New MySqlConnection()
con.ConnectionString = String.Format("server={0}; user id={1}; password={2}; database={3}; pooling=false", host, user, pwd, db)
sql = "select hoscode,d315,count(b210) as b210,count(d310) as d310,count(d315) as d315,count(d330) as d330,count(d335) as d335 " & _
"from person_deform_head pdh " & _
"group by pdh.hoscode,pdh.b210,pdh.d315 "
command = New MySqlCommand(sql, con)
con.Open()
command.Connection = con
'MsgBox("Successfully connected!", MsgBoxStyle.Information)
adapter = New MySqlDataAdapter(command)
datast = New DataSet()
adapter.Fill(datast, "ph")
gc1.DataSource = datast.Tables("ph")
sql = "SELECT count(b210) FROM person_deform_head "
command = New MySqlCommand(sql, con)
Dim b210 As Integer = command.ExecuteScalar()
sql = "SELECT count(d310) FROM person_deform_head "
command = New MySqlCommand(sql, con)
Dim d310 As Integer = command.ExecuteScalar()
gc1.rows.Add(New String() {b210, d310}) '--เพิ่มรายการที่ละแถว
End Sub