TAILIEUCHUNG - bài tập kỹ thuật load XML vào dataset và insert vào database

đặt ra 1 bài toán : bạn được bên A giao cho dữ liệu của 1 bảng (User) bằng XML và yêu cầu bạn Insert toàn bộ dữ liệu đó vào DB của mình. Mình sẽ giải quyết như sau: 1 admin | đặt ra 1 bài toán bạn được bên A giao cho dữ liệu của 1 bảng User bằng XML và yêu cầu bạn Insert toàn bộ dữ liệu đó vào DB của mình. Mình sẽ giải quyết như sau newForumAsh user userid 1 userid username admin username password 3349311e8bdb5b11d9f49ff2047e5631 password email admin@ email user user userid 2 userid username user12 username password e493716f73d8e1c410bfbfe3e910d3af password email user12@ email user user userid 3 userid username user1 username password f65696f9d46fa5b8c70b2e20c045cdbf password email user1@ email user newForumAsh trong trang aspx bạn tạo 1 form upload cho người dùng để upload file xml lên sau đó trong code behind Public ValueInsert As Integer 0 Private Sub btnImport_Click ByVal sender As Object ByVal e As Handles Try Dim strEmail As String Dim strPassword As String Dim strUserName As String luu ra folder tam tren may chu Dim strTempPath As String Temp upload len folder tam If Then chi upload file xml If text xml Then luu xuong may chu strTempPath khoi tao dataset Dim ds As DataSet New DataSet load file sau khi upload vao stream Dim fsReadXml As New strTempPath dataset doc file xml tu stream fsReadXml dong stream khoi tao 1 datatable de dua dataset vao Dim dbTable As DataTable 0 duyet den tung dong trong table For Each row As DataRow In gan cho moi bien vao cac truong strEmail row email .ToString strPassword row password .ToString strUserName row username .ToString If strEmail vbNullString Then strEmail End If If strPassword vbNullString Then strPassword End If If strUserName vbNullString Then strUserName End If tao user strUserName strPassword strEmail tang gia tri insert len 1 sau moi lan insert ValueInsert ValueInsert 1 Next xoa

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.