基于vs2008 c# Windows 窗体应用程序开发的系统,学生管理系统等各种管理系统(什么都行)

如题所述

Imports System.Data.SqlClient
Public Class Form3
Dim conn As New SqlConnection
Dim ds As New DataSet
Public flag As Integer

Function open() As Long
ds.Tables.Clear()
Dim str = "select * from 采购单"
Dim da As New SqlDataAdapter(str, conn)
da.Fill(ds)
DataGridView1.ColumnCount = ds.Tables(0).Columns.Count
DataGridView1.RowCount = ds.Tables(0).Rows.Count
For i = 0 To ds.Tables(0).Rows.Count - 1
For j = 0 To ds.Tables(0).Columns.Count - 1
DataGridView1.Rows(i).Cells(j).Value = ds.Tables(0).Rows(i).ItemArray(j)
Next
Next
For i = 0 To ds.Tables(0).Columns.Count - 1
DataGridView1.Columns(i).HeaderText = ds.Tables(0).Columns(i).ColumnName
温馨提示:内容为网友见解,仅供参考
第1个回答  2011-12-22
这个看有什么需求了。
相似回答