Private Sub combd(Optional ByVal oka As Boolean = False, Optional ByVal co As ComboBox = Nothing)
我們提供的服務(wù)有:成都網(wǎng)站制作、網(wǎng)站建設(shè)、外貿(mào)網(wǎng)站建設(shè)、微信公眾號(hào)開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、寧化ssl等。為近1000家企事業(yè)單位解決了網(wǎng)站和推廣的問題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的寧化網(wǎng)站制作公司
Dim adm As New chhui.chycom
adm.ComboBoxfill(ComboBox1, "xm", "renwu", hd)
adm.ComboBoxfill(ComboBox6, "bh", "biaoti", hd)
adm.ComboBoxfill(ComboBox5, "xmmch", "xmxx", hd)
'adm.ComboBoxfill(ComboBox3, "color", "biaoti")
'adm.ComboBoxfill(ComboBox4, "zt", "biaoti")
End Sub
在配置文件app.config中加入
appSettings
add key="LotDBConnection" value="DATA SOURCE=數(shù)據(jù)庫連接;PASSWORD=密碼;PERSIST SECURITY INFO=True;USER ID=登錄名"/
/appSettings
//m_SqlPath 存放SQL語句的XML文件
Dim sqlHelper As New SQLHelper("LotDBConnection")
Dim sqlRead As New ResourceHelper
Dim ht As New Hashtable
Dim strSQL As String
Try
'設(shè)置SQL文參數(shù)
ht.Clear()
ht.Add(ColumnName.USER_ID.ToString, Trim(Me.txtUserID.Text))
ht.Add(ColumnName.USER_NAME.ToString, Trim(Me.txtUserName.Text))
'數(shù)據(jù)查詢
strSQL = sqlRead.GetSQLSentence("GetUserList", m_SqlPath, ht)
ds = sqlHelper.ExecuteDataSet(strSQL)
If ds.Tables(0).Rows.Count = 0 Then
MessageBox .Show ("數(shù)據(jù)不存在");
Else
'數(shù)據(jù)綁定
dgvUserMeisai.DataSource = ds.Tables(0)
End If
Catch ex As Exception
MessageBox .Show (ex.Message );
Finally
sqlHelper = Nothing
sqlRead = Nothing
ht = Nothing
End Try
應(yīng)為網(wǎng)頁的問題,Datatable的數(shù)據(jù)不會(huì)被存儲(chǔ)下來,所以需要在排序和分頁后重新綁定數(shù)據(jù)源。
分頁事件
GridViewBrowser.PageIndexChanging
設(shè)定新頁碼PageIndex
GridViewBrowser.PageIndex = e.NewPageIndex
添加數(shù)據(jù)源綁定代碼
Dim mydap As New SqlDataAdapter(sql, conn)
Dim ds As New DataSet()
mydap.Fill(ds)
GridView1.DataSource = ds
GridView1.DataBind()
排序邏輯等同....