« [ASP.NET|SQL Server] SQL Server �����異���ƥ���� | �ᥤ�� | [ASP.NET|SQL Server] SQL Server ����ɥ��åץ�����ꥹ�Ȥ� »
2005年10月06日
[ASP.NET] DataGrid ��ɽ����3�ѥ������
'�㣱�� �ǡ����ơ��֥� Dim DT As DataTable = New DataTable Dim DR As DataRowDT.Columns.Add(New DataColumn("����", GetType(String)))
DT.Columns.Add(New DataColumn("����", GetType(String)))
DT.Columns.Add(New DataColumn("����", GetType(String)))DR = DT.NewRow
DR(0) = "UserID" : DR(1) = User.Identity.Name : DR(2) = ""
DT.Rows.Add(DR)DR = DT.NewRow
DR(0) = "UserPass" : DR(1) = "******" : DR(2) = "�ѥ���ɤ���ɽ���ˤ��Ƥ��ޤ���"
DT.Rows.Add(DR)DR = DT.NewRow
DR(0) = "UserName" : DR(1) = DB_LName & " " & DB_FName & "������" : DR(2) = ""
DT.Rows.Add(DR)DR = DT.NewRow
DR(0) = "UserRole" : DR(1) = UserRole : DR(2) = ""
DT.Rows.Add(DR)Dim DV As DataView = New DataView(DT)
DataGrid1.DataSource = DV
DataGrid1.DataBind()
'�㣲�� �ǡ����ơ��֥��û�������ɡ�' Create a table to store data for the DropDownList control.
Dim DT As DataTable = New DataTable' Define the columns of the table.
DT.Columns.Add(New DataColumn("ColorTextField", GetType(String)))
DT.Columns.Add(New DataColumn("ColorValueField", GetType(String)))' Populate the table with sample values.
DT.Rows.Add(CreateRow("White", "White", DT))
DT.Rows.Add(CreateRow("Silver", "Silver", DT))
DT.Rows.Add(CreateRow("Dark Gray", "DarkGray", DT))
DT.Rows.Add(CreateRow("Khaki", "Khaki", DT))
DT.Rows.Add(CreateRow("Dark Khaki", "DarkKhaki", DT))' Create a DataView from the DataTable to act as the data source
' for the DropDownList control.
Dim DV As DataView = New DataView(DT)DataGrid1.DataSource = DV
DataGrid1.DataBind()
'�㣳�� �ǡ������åȡʥǡ��������ץ����ѡ�Dim DA As New System.Data.SqlClient.SqlDataAdapter
Dim DS As New DataSetDA.SelectCommand = Cmd
DS.Clear()
DA.Fill(DS, "�Ұ��ꥹ��")DataGrid1.DataSource = DS
DataGrid1.DataBind()
2005 / 10 / 06