-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: DesignedforDOTNet
Message 7 in Discussion
hi.... got this code from the ms site
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
'Put user code to initialize the page here
' Create variables that are used in code sample.
Dim i, j As Integer
' Create connection string variable. Modify the "Data Source" parameter as
' appropriate for your environment.
Dim sConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=c:\ExcelData.xls" _
& ";" & "Extended Properties=Excel 8.0;"
' Create the connection object by using the preceding connection string.
Dim objConn As New OleDbConnection(sConnectionString)
' Open connection with the database.
objConn.Open()
' The code to follow uses a SQL SELECT command to display the data from the worksheet.
' Create new OleDbCommand to return data from worksheet.
Dim objCmdSelect As New OleDbCommand("SELECT * FROM [Sheet1$]", objConn)
' Create new OleDbDataAdapter that is used to build a DataSet
' based on the preceding SQL SELECT statement.
Dim objAdapter1 As New OleDbDataAdapter
' Pass the Select command to the adapter.
objAdapter1.SelectCommand = objCmdSelect
' Create new DataSet to hold information from the worksheet.
Dim objDataset1 As New DataSet
' Fill the DataSet with the information from the worksheet.
objAdapter1.Fill(objDataset1, "XLData")
objDataset1.WriteXml("C:\testxmlfile.xml", XmlWriteMode.WriteSchema)
' Build a table from the original data.
DataGrid1.DataSource = objDataset1.Tables(0).DefaultView
DataGrid1.DataBind()
' Clean up objects.
objConn.Close()
cheers
Kannan.V
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/BDotNet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]