السلام عليكم
كيف الحال اخواني اعضاء ومشرفين المنتدى ..
عندي هذه الانسرت عملت جدول وهمي .. واريد ان اعرض البيانات الي اضيفها في الجدول والهمي في قرد فيو . ولكن يقولي تعذر العثور على العمود (0) موش عارف ليش يطلع لي هذه الخطاء ياليت تقولو لي ايش الخطاء في الكود وشكراْ
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
xx()
End Sub
Sub xx()
Dim tab1 As New DataTable
tab1.PrimaryKey = New DataColumn() {tab1.Columns(0)}
Dim tabIDclom As New DataColumn("ID", GetType(Integer))
tabIDclom.Caption = "id"
tabIDclom.AllowDBNull = False
tabIDclom.Unique = True
Dim tabname As New DataColumn("name ", GetType(String))
tabname.Caption = "name"
Dim tabsal As New DataColumn("sal", GetType(Integer))
tabsal.Caption = "sal"
Dim tabage As New DataColumn("age", GetType(Integer))
tabsal.Caption = "age"
tab1.Columns.AddRange(New DataColumn() {tabIDclom, tabname, tabsal, tabage})
Dim row As DataRow = tab1.NewRow()
row("name") = "taha"
row("sal") = 1000
row("age") = 20
ds = New DataSet
ds.Tables.Add(tab1)
GridView1.DataSource = ds.Tables(0)
GridView1.DataBind()
End Sub