问题描述
您好我已阅读此网站进行排序DATAGRIDVIEW []
我的代码是这样的:
hello I have read this site for sorting DATAGRIDVIEW http://vb.net-informations.com/datagridview/vb.net_datagridview_sort.htm[^]
and had my code that is like this:
Public conmainWin As String = "user=SYSDBA;password=masterkey;DataBase=C:\My_Database\CLIENT_CUSTOMER.FDB; datasource=localhost;Port=3050;Dialect=3;Charset=ASCII;Role=SA;Connection Lifetime=0;Connection timeout=15;pooling=true;packet size=8192;server type=0" 'DB path GFLINVENTORY
Public fbcon As New FbConnection 'FOR FB CONNECTION
Public fbcmd As FbCommand 'TO EXECUTE FB COMMAND
Public fbdr As FbDataReader 'TO READ FB DATA
Public sql As String
Public Sub DBAddUpdate(ByVal sqlAddUpd As String)
Try
fbcon = New FbConnection(conmainWin)
fbcon.Open()
sql = sqlAddUpd
fbcmd = New FbCommand(sql, fbcon)
fbcmd.ExecuteNonQuery()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Public Sub DBClose()
fbcon.Close()
fbcon.Dispose()
End Sub
和我的按钮用于排序datagridview:
and my button for sorting datagridview:
Try
Call DBAddUpdate("SELECT * FROM UNPAID_FORM")
DBClose()
Dim fireBirdCon As New FbConnection
fireBirdCon = New FbConnection(conmainWin)
Dim firebirdAdap As New FbDataAdapter(sql, fireBirdCon)
Dim FBds As New gflSOADataSet
fireBirdCon.Open()
firebirdAdap.Fill(FBds, "UNPAID_FORM")
fireBirdCon.Close()
Dim dataVw As New DataView
dataVw = New DataView(FBds.Tables(1), "PARTICULARS > 19", "PARTICULARS ASC", DataViewRowState.CurrentRows)
UNPAID_FORMDataGridView.DataSource = dataVw
MsgBox("Item sorted.", MsgBoxStyle.Information Or MsgBoxStyle.OkOnly, "Information Retrieved")
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error!")
End Try
但有异常错误,如下所示:在代码行中找不到列[详细信息]
but had exception error that goes like this: Cannot find column [PARTICULARS] in code line
dataVw = New DataView(FBds.Tables(1), "PARTICULARS > 19", "PARTICULARS ASC", DataViewRowState.CurrentRows)
我的第一栏名为PARTICULARS -varchar(35),其记录如此
''20%项目中的2项''
''20%项目中的1项''
''20%项目中的7项''
''的20%项目''
。
。
。
,我想以自然的方式排序。请帮帮我..
makoy03
my first column is named PARTICULARS -varchar(35) that has record that goes like this"
''2 of 20% item''
''1 of 20% item''
''7 of 20% item''
''3 of 20% item''
.
.
.
that i wanted to sort in a natural way. Please help me..
makoy03
推荐答案
这篇关于排序DATAGRID视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!