SQL语句问题具体什么意思呢?
SQL语句问题
底下SQL查询语法中的 as A 和 as B 是什么意思?
为什么A和B不用定义就能用?
程序代码:
Private Sub LoadFileList(ByVal strSubjectNo As String, ByVal strSubFolderNo As String)
Dim mySQL As String
mySQL = "SELECT ROW_NUMBER() OVER (" & hdfFileListOrderBy.Value & ") AS RowNo, A.*, B.EmployeeName AS ReviserName FROM tblFileList AS A "
mySQL += "LEFT OUTER JOIN tblMstEmployee AS B ON A.ReviserNo = B.EmployeeNo "
mySQL += "WHERE A.SubjectNo = '" & strSubjectNo & "' AND A.SubFolderNo = " & strSubFolderNo
If lblFileMgnTitleChi.Text <> "内部下载" Then
mySQL += "AND A.ShowInPublic = 'Y'"
End If
Try
Using mySqlDS As SqlDataSource = New SqlDataSource
mySqlDS.ProviderName = strDbType
mySqlDS.ConnectionString = WebConfigurationManager.ConnectionStrings(strCnnType & "DbBTA").ConnectionString
mySqlDS.SelectCommand = mySQL
mySqlDS.DataSourceMode = SqlDataSourceMode.DataSet
Dim my_args As New DataSourceSelectArguments
Dim my_DV As Data.DataView = mySqlDS.Select(my_args)
lvFileList.DataSource = my_DV
lvFileList.DataBind()
End Using
Catch ex As Exception
Dim strErr As String = "●●● 程式错误讯息如下 ●●●" & "\n\n" & Replace(Replace(Replace(Replace(Trim(ex.ToString()), Chr(10), ""), Chr(13), ""), "\", "\\"), "'", "\'")
ScriptManager.RegisterStartupScript(Me, Me.GetType(), "alert", "alert('" & strErr & "');", True)
End Try
End Sub
Dim mySQL As String
mySQL = "SELECT ROW_NUMBER() OVER (" & hdfFileListOrderBy.Value & ") AS RowNo, A.*, B.EmployeeName AS ReviserName FROM tblFileList AS A "
mySQL += "LEFT OUTER JOIN tblMstEmployee AS B ON A.ReviserNo = B.EmployeeNo "
mySQL += "WHERE A.SubjectNo = '" & strSubjectNo & "' AND A.SubFolderNo = " & strSubFolderNo
If lblFileMgnTitleChi.Text <> "内部下载" Then
mySQL += "AND A.ShowInPublic = 'Y'"
End If
Try
Using mySqlDS As SqlDataSource = New SqlDataSource
mySqlDS.ProviderName = strDbType
mySqlDS.ConnectionString = WebConfigurationManager.ConnectionStrings(strCnnType & "DbBTA").ConnectionString
mySqlDS.SelectCommand = mySQL
mySqlDS.DataSourceMode = SqlDataSourceMode.DataSet
Dim my_args As New DataSourceSelectArguments
Dim my_DV As Data.DataView = mySqlDS.Select(my_args)
lvFileList.DataSource = my_DV
lvFileList.DataBind()
End Using
Catch ex As Exception
Dim strErr As String = "●●● 程式错误讯息如下 ●●●" & "\n\n" & Replace(Replace(Replace(Replace(Trim(ex.ToString()), Chr(10), ""), Chr(13), ""), "\", "\\"), "'", "\'")
ScriptManager.RegisterStartupScript(Me, Me.GetType(), "alert", "alert('" & strErr & "');", True)
End Try
End Sub