I retrieved data from access in vb10 between two dates and here is the code for dat:
Imports System.Data.OleDb
Public Class Form4
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
con = New OleDbConnection("Provider=Microsoft.JET.OLEDB.4.0;" & _
"Data Source=C:/Users/Space Era/Documents/perf.mdb")
con.Open()
Dim dataset1 As New DataSet()
Dim sqlstring As String = "SELECT data.[S No], data.Date, data.[Server Name], data.Directory, data.Media, data.[Media id], data.Status, data.[Start Time], data.[End Time], data.[Action taken], data.[Backup taken by], data.[Tape Name] FROM data where Date>= '" & DateTimePicker2.Text & "' and Date <'" & DateTimePicker1.Text & "' "
cmd = New OleDbCommand(sqlstring, con)
Dim oledbdataadapter1 As System.Data.OleDb.OleDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter(cmd)
oledbdataadapter1.Fill(dataset1, "data")
DataGridView1.DataSource = dataset1.Tables("data")
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
con.Close()
End Sub
now i want to display the result in excel sheet...if nybdy out there cn suggest smthng..i wud be greatful..