這個(gè)警告說明你并非所有分支上都有return值
阜康網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián)建站,阜康網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為阜康上1000家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站建設(shè)公司要多少錢,請找那個(gè)售后服務(wù)好的阜康做網(wǎng)站的公司定做!
解決方法:如果在某個(gè)分支不需要處理 則返回默認(rèn)值即可
1、安裝文件沒有做好
2、生成的目錄中有多個(gè)文件,必須都放在同一目錄下
1、沒有初始化Pro32,僅僅是定義了。
2、在結(jié)束函數(shù)findfile的地方,例如end function,return之前沒有設(shè)置返回值。
VB點(diǎn)虐 編程還用goto?建議不要用這個(gè)。
Private Function getAccessConnection() As OleDbConnection
'整體思路應(yīng)該是:連接數(shù)據(jù)庫-運(yùn)用適配器運(yùn)行查詢詞句-將查詢結(jié)果填充到數(shù)據(jù)集-以數(shù)據(jù)集為數(shù)據(jù)源,在DataGrid中顯示。
Dim dbConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=|DataDirectory|\Resources\mag.mdb;Persist Security Info=true"
'連接字符串,Provider,連接引擎,可以死記,OLEDB就用這處,Data Source,設(shè)置數(shù)據(jù)庫的位置。
Dim dbConnection As OleDbConnection = New OleDbConnection(dbConnectionString)
Try
dbConnection.Open()
Catch Ex As Exception
’MsgBox(Err.Description)
End Try
Return dbConnection
End Function
private Sub fillDataGridView()
Dim sqlStr As String = "select * from Table"
Dim DataAdapter As New OleDbDataAdapter
Dim dataSet As New DataSet
Dim DataGridView As New DataGridView
Dim dbConnection As OleDbConnection = getAccessConnection()
If dbConnection.State.ToString = "Closed" Then
MsgBox(Chr(13) " access 數(shù)據(jù)庫連接失敗 " Chr(13), , "警告")
Exit Sub
End If
DataAdapter.SelectCommand = New OleDbCommand(sqlStr,dbConnection)
'用數(shù)據(jù)適配器進(jìn)行查詢
Try
DataAdapter.Fill(dataSet,"Table") '將查詢結(jié)果填充到數(shù)據(jù)集Dataset,有點(diǎn)像VB中的記錄集recordset
DataGridView.DataSource = dataSet.Tables("Table").DefaultView '將數(shù)據(jù)集的內(nèi)容在表格中顯示出來
Catch Ex As Exception
MsgBox(Err.Description)
Finally
dataSet.Dispose
DataAdapter.Dispose
dbConnection.Close
dbConnection.Dispose
End Try
End Sub