السبت، ٨ نوفمبر ٢٠٠٨

From Excel to SQl من أكسل للسكوال

أذا كنت تبحث عن كيفية نقل بيانات من ملف اكسل لخادم اس كيو ال فها هى الطريقة.

Dim xconStr As String = "provider=microsoft.jet.oledb.4.0;Data source=" & Server.MapPath("Excel" & "\" & "StudentSheet.xsl") & _
--server.MapPath("مكان ملف الاكسل على الخادم")
";Extended properties=Excel 8.0"
Dim xcon As New OleDbConnection(xconStr)
Dim xcom As New OleDbCommand("Select * from [Sheet1$]", xcon)
--sheet1 هو اسم الجدول داخل ملف الاكسل
--important يجب وضع علامة الدولار
Dim xadaptor As New OleDbDataAdapter(xcom)
Dim dsxcel As New DataSet
xadaptor.Fill(dsxcel)


0 التعليقات: