; 이 코드에서 무엇이 잘못 되었습니까? 아래 오류를주는 중 ... 'xxxx'열이 기본 테이블 ''에 속해 있지 않습니다.'xxxx'열이 기본 테이블에 속해 있지 않습니다. '오류
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
Dim connStr As String = ConfigurationManager.ConnectionStrings("FBB-DSL-DBConnectionString").ConnectionString
Dim tablex As New DataTable()
Using conn As New SqlConnection(connStr)
Using cmd As New SqlCommand("sp_columns", conn)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.AddWithValue("@table_name", "tbl_EmpRecords")
' get the adapter object and attach the command object to it
Using ad As New SqlDataAdapter(cmd)
' fire Fill method to fetch the data and fill into DataTable
ad.Fill(tablex)
End Using
End Using
End Using
'Creating DataView
Dim view As New DataView(tablex)
Dim dt As DataTable = view.ToTable(False, "COLUMN_NAME")
CheckBoxList1.DataSource = dt
CheckBoxList1.DataBind()
End If
End Sub
_view.ToTable_의 두 번째 매개 변수는 DataTable의 기존 열 이름이어야합니다. _tablex_ _tablex_에 해당 이름의 열이 있습니까? – Steve
예이 이름이 "xxxx"인 테이블이 포함 된 열 – BATT
죄송합니다. 다른 설명이 없습니다. TableX는 시스템 정의 _sp_column_ 저장 프로 시저를 사용하여 채 웁니다. 이 저장 프로시 저는 'xxxxx'라는 필드가없는 데이터 테이블을 생성합니다. 사용하려고하는 열의 실제 이름은 무엇입니까? – Steve