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

2024-12-19 20:46:00
推荐回答(2个)
回答1:

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

回答2:

这个看有什么需求了。