Need Date&Time with millisecond while generating Excel reportProblem in excel report generationExcel Report generationConvert milliseconds to date (in Excel)Display milliseconds in ExcelSystem.Data.OleDb.OleDbException invalid argumentVb.net connection timeout while generating excel reportGenerating report in ExcelInserting text in a embedded Word template, at a bookmark, from excel. “error 13 Type mismatch” errorExcel SUMIF with Date&Time Cells Compared to Array of Date&Time Cells (OR Statement)
SQL Server Management Studio - Why is Dark Theme Disabled by Default?
Would the Republic of Ireland and Northern Ireland be interested in reuniting?
Did a flight controller ever answer Flight with a no-go?
Why did Khan ask Admiral James T. Kirk about Project Genesis?
Is immersion of utensils (tevila) valid before koshering (hagala)?
What is a CirKle Word™?
How is the idea of "two people having a heated argument" idiomatically expressed in German?
Is gzip atomic?
Did the British navy fail to take into account the ballistics correction due to Coriolis force during WW1 Falkland Islands battle?
Do they have Supervillain(s)?
How much authority do teachers get from *In Loco Parentis*?
Avoiding racist tropes in fantasy
How do I get toddlers to stop asking for food every hour?
Can a Rogue PC teach an NPC to perform Sneak Attack?
Why doesn't 'd /= d' throw a division by zero exception?
How would one country purchase another?
Why is there so little discussion / research on the philosophy of precision?
How do you harvest carrots in creative mode?
Prove your innocence
How would you identify when an object in a Lissajous orbit needs station keeping?
Is there any method of inflicting the incapacitated condition and no other condition?
Handling Disruptive Student on the Autistic Spectrum
Tensorflow - logistic regrssion -oneHot Encoder - Transformed array of differt size for both train and test
How do I request a longer than normal leave of absence period for my wedding?
Need Date&Time with millisecond while generating Excel report
Problem in excel report generationExcel Report generationConvert milliseconds to date (in Excel)Display milliseconds in ExcelSystem.Data.OleDb.OleDbException invalid argumentVb.net connection timeout while generating excel reportGenerating report in ExcelInserting text in a embedded Word template, at a bookmark, from excel. “error 13 Type mismatch” errorExcel SUMIF with Date&Time Cells Compared to Array of Date&Time Cells (OR Statement)
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am going to Log my process parameters in SQL and generate Excel Reports.
The Programming is done in VB.Net
we are going to log Date_Time in 'YYYY-MM-DD HH:mm:ss.ms' example:'2018-11-27 21:41:24.170' (Here ms is milisec.)
But while exporting with excel it comes in '27/11/18 21:41:24.000' not able to show millisecond data(here it is .170) .
So, Can you please let me know how i can show date&Time including millisecond in Excel.
Excel Setting for Date Column : dd/mm/yy hh:mm:ss.000
Please find Database snap , Generated report snap and Vb.net program for your reference.
Please let me know your suggestions So,it will resolve my issue.
01 .DatabseImage
02.Generated Report
Imports System.Data
Imports System.Data.SqlClient
' For th is need to add Microsoft Excel componant from project > Add Ref > Com
Imports Excelr = Microsoft.Office.Interop.Excel
Module Module1
Dim conn As SqlConnection
Dim path As String = "C:mysettxtupConnectionstring.txt"
Dim objectreader As New System.IO.StreamReader(path)
Dim connetionString As String
Dim adpt As New SqlDataAdapter
Dim ds As New DataSet
' used for excel report
Dim r, c As Integer
Private Sub releaseObject(ByVal obj As Object)
Try
System.Runtime.InteropServices.Marshal.ReleaseComObject(obj)
obj = Nothing
Catch ex As Exception
obj = Nothing
Finally
GC.Collect()
End Try
End Sub
Sub Main()
'----- Read SQl Connection from Text File------
connetionString = objectreader.ReadLine
conn = New SqlConnection(connetionString)
'Dim trn_Log1, trn_Log2 As ADODB.Recordset
'************************************************************************************************************
' Set the Format type and the CustomFormat string.
'Start date
' DateTimePickerST.Format = DateTimePickerFormat.Custom
' DateTimePickerST.CustomFormat = "MM/dd/yyyy H:mm"
'Clear connection and dataset before open
conn.Close()
ds.Clear()
'To handle exception use here Try catach
Try
'Open connection
conn.Open()
'Dim query As String
' Dim query As String = "Select * from ProDataTbl1Sec where Date_Time between '" & RStartDate.Text & "'and'" & REndDate.Text & "'order by date_time asc"
Dim query As String = "SELECT * FROM ProDataTbl1Sec WHERE Date_Time >= dateadd(hour,-24,getdate())"
'Dim query As String = "SELECT * FROM ProDataTbl1Sec"
adpt.SelectCommand = New SqlCommand(query, conn)
ds = New DataSet("wincc")
adpt.Fill(ds)
Dim i, j As Integer
' Standard for Excel application
Dim xlApp As Excelr.Application
Dim xlWorkBook As Excelr.Workbook
Dim xlWorkSheet As Excelr.Worksheet
'Dim shXL As Excel.Worksheet
'xlWorkSheet.Visible = True
Dim misValue As Object = System.Reflection.Missing.Value
' Dim xlSourceRange As Excel.Range
xlApp = New Excelr.Application
' ------- Read Sample Report Location from Text file ------
'Dim path As String = "C:Pallmysetupconnectionstring.txt"
'Dim objectreader As New System.IO.StreamReader(path)
'connetionString = objectreader.ReadLine
'conn = New SqlConnection(connetionString)
Dim Srpath As String = "C:mysettxtupsamplereport.txt"
Dim Srobjectreader As New System.IO.StreamReader(Srpath)
Dim Srpathstring As String = Srobjectreader.ReadLine
' ------- Read Sample Report Location from Text file ------
xlWorkBook = xlApp.Workbooks.Add(Srpathstring & "SampleReport")
' ------- Save as Report Location from Text file ------
Dim Slrpath As String = "C:mysettxtupSavereport.txt"
Dim Slrobjectreader As New System.IO.StreamReader(Slrpath)
Dim Slrpathstring As String = Slrobjectreader.ReadLine
'xlWorkSheet = xlWorkBook.Sheets("D:PallReportSampleReport")
xlWorkSheet = xlWorkBook.Sheets("Report")
r = ds.Tables(0).Rows.Count + 7 ' 7 add here because we start 1 record from 8th row
c = ds.Tables(0).Columns.Count
Console.WriteLine(r)
Console.WriteLine(c)
Console.WriteLine("Work in Process")
' Print Table Row with column of worksheet
For i = 0 To ds.Tables(0).Rows.Count - 1
'For j = 0 To ds.Tables(0).Columns.Count - 1
For j = 0 To ds.Tables(0).Columns.Count - 1
xlWorkSheet.Cells(i + 8, j + 1) = ds.Tables(0).Rows(i).Item(j)
xlWorkSheet.Columns("A:I").EntireColumn.AutoFit()
'xlWorkSheet.Columns("A").EntireColumn.farmat()
Next
Console.WriteLine(i)
Next
' Save Excel Sheet
'~~> Save Worksheet file to the following location
'xlWorkSheet.SaveAs("E:VBReportvbexcel_" + currentdate.ToString() + "xlsx")
Dim currentdate As String = String.Format("0:ddMMyyyy-Hmm ", DateTime.Now)
' Excel Animation
'xlWorkSheet.Columns("A:I").EntireColumn.AutoFit()
With xlWorkSheet
.Range("A2").Value() = "Date : " & currentdate
End With
' ------- Save as Report Location from Text file ------
'RLocation.Text = " Report save in " & Slrpathstring
xlWorkSheet.SaveAs(Slrpathstring & "ParagDailyReport_" & currentdate & ".xlsx")
xlWorkBook.Close()
xlApp.Quit()
releaseObject(xlApp)
releaseObject(xlWorkBook)
releaseObject(xlWorkSheet)
'close connection , dadaptor and clear dataset
conn.Close()
adpt.Dispose()
ds.Dispose()
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End Sub
End Module
sql-server excel sql-server-2008-r2 ado.net
migrated from dba.stackexchange.com Mar 27 at 17:34
This question came from our site for database professionals who wish to improve their database skills and learn from others in the community.
add a comment |
I am going to Log my process parameters in SQL and generate Excel Reports.
The Programming is done in VB.Net
we are going to log Date_Time in 'YYYY-MM-DD HH:mm:ss.ms' example:'2018-11-27 21:41:24.170' (Here ms is milisec.)
But while exporting with excel it comes in '27/11/18 21:41:24.000' not able to show millisecond data(here it is .170) .
So, Can you please let me know how i can show date&Time including millisecond in Excel.
Excel Setting for Date Column : dd/mm/yy hh:mm:ss.000
Please find Database snap , Generated report snap and Vb.net program for your reference.
Please let me know your suggestions So,it will resolve my issue.
01 .DatabseImage
02.Generated Report
Imports System.Data
Imports System.Data.SqlClient
' For th is need to add Microsoft Excel componant from project > Add Ref > Com
Imports Excelr = Microsoft.Office.Interop.Excel
Module Module1
Dim conn As SqlConnection
Dim path As String = "C:mysettxtupConnectionstring.txt"
Dim objectreader As New System.IO.StreamReader(path)
Dim connetionString As String
Dim adpt As New SqlDataAdapter
Dim ds As New DataSet
' used for excel report
Dim r, c As Integer
Private Sub releaseObject(ByVal obj As Object)
Try
System.Runtime.InteropServices.Marshal.ReleaseComObject(obj)
obj = Nothing
Catch ex As Exception
obj = Nothing
Finally
GC.Collect()
End Try
End Sub
Sub Main()
'----- Read SQl Connection from Text File------
connetionString = objectreader.ReadLine
conn = New SqlConnection(connetionString)
'Dim trn_Log1, trn_Log2 As ADODB.Recordset
'************************************************************************************************************
' Set the Format type and the CustomFormat string.
'Start date
' DateTimePickerST.Format = DateTimePickerFormat.Custom
' DateTimePickerST.CustomFormat = "MM/dd/yyyy H:mm"
'Clear connection and dataset before open
conn.Close()
ds.Clear()
'To handle exception use here Try catach
Try
'Open connection
conn.Open()
'Dim query As String
' Dim query As String = "Select * from ProDataTbl1Sec where Date_Time between '" & RStartDate.Text & "'and'" & REndDate.Text & "'order by date_time asc"
Dim query As String = "SELECT * FROM ProDataTbl1Sec WHERE Date_Time >= dateadd(hour,-24,getdate())"
'Dim query As String = "SELECT * FROM ProDataTbl1Sec"
adpt.SelectCommand = New SqlCommand(query, conn)
ds = New DataSet("wincc")
adpt.Fill(ds)
Dim i, j As Integer
' Standard for Excel application
Dim xlApp As Excelr.Application
Dim xlWorkBook As Excelr.Workbook
Dim xlWorkSheet As Excelr.Worksheet
'Dim shXL As Excel.Worksheet
'xlWorkSheet.Visible = True
Dim misValue As Object = System.Reflection.Missing.Value
' Dim xlSourceRange As Excel.Range
xlApp = New Excelr.Application
' ------- Read Sample Report Location from Text file ------
'Dim path As String = "C:Pallmysetupconnectionstring.txt"
'Dim objectreader As New System.IO.StreamReader(path)
'connetionString = objectreader.ReadLine
'conn = New SqlConnection(connetionString)
Dim Srpath As String = "C:mysettxtupsamplereport.txt"
Dim Srobjectreader As New System.IO.StreamReader(Srpath)
Dim Srpathstring As String = Srobjectreader.ReadLine
' ------- Read Sample Report Location from Text file ------
xlWorkBook = xlApp.Workbooks.Add(Srpathstring & "SampleReport")
' ------- Save as Report Location from Text file ------
Dim Slrpath As String = "C:mysettxtupSavereport.txt"
Dim Slrobjectreader As New System.IO.StreamReader(Slrpath)
Dim Slrpathstring As String = Slrobjectreader.ReadLine
'xlWorkSheet = xlWorkBook.Sheets("D:PallReportSampleReport")
xlWorkSheet = xlWorkBook.Sheets("Report")
r = ds.Tables(0).Rows.Count + 7 ' 7 add here because we start 1 record from 8th row
c = ds.Tables(0).Columns.Count
Console.WriteLine(r)
Console.WriteLine(c)
Console.WriteLine("Work in Process")
' Print Table Row with column of worksheet
For i = 0 To ds.Tables(0).Rows.Count - 1
'For j = 0 To ds.Tables(0).Columns.Count - 1
For j = 0 To ds.Tables(0).Columns.Count - 1
xlWorkSheet.Cells(i + 8, j + 1) = ds.Tables(0).Rows(i).Item(j)
xlWorkSheet.Columns("A:I").EntireColumn.AutoFit()
'xlWorkSheet.Columns("A").EntireColumn.farmat()
Next
Console.WriteLine(i)
Next
' Save Excel Sheet
'~~> Save Worksheet file to the following location
'xlWorkSheet.SaveAs("E:VBReportvbexcel_" + currentdate.ToString() + "xlsx")
Dim currentdate As String = String.Format("0:ddMMyyyy-Hmm ", DateTime.Now)
' Excel Animation
'xlWorkSheet.Columns("A:I").EntireColumn.AutoFit()
With xlWorkSheet
.Range("A2").Value() = "Date : " & currentdate
End With
' ------- Save as Report Location from Text file ------
'RLocation.Text = " Report save in " & Slrpathstring
xlWorkSheet.SaveAs(Slrpathstring & "ParagDailyReport_" & currentdate & ".xlsx")
xlWorkBook.Close()
xlApp.Quit()
releaseObject(xlApp)
releaseObject(xlWorkBook)
releaseObject(xlWorkSheet)
'close connection , dadaptor and clear dataset
conn.Close()
adpt.Dispose()
ds.Dispose()
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End Sub
End Module
sql-server excel sql-server-2008-r2 ado.net
migrated from dba.stackexchange.com Mar 27 at 17:34
This question came from our site for database professionals who wish to improve their database skills and learn from others in the community.
add a comment |
I am going to Log my process parameters in SQL and generate Excel Reports.
The Programming is done in VB.Net
we are going to log Date_Time in 'YYYY-MM-DD HH:mm:ss.ms' example:'2018-11-27 21:41:24.170' (Here ms is milisec.)
But while exporting with excel it comes in '27/11/18 21:41:24.000' not able to show millisecond data(here it is .170) .
So, Can you please let me know how i can show date&Time including millisecond in Excel.
Excel Setting for Date Column : dd/mm/yy hh:mm:ss.000
Please find Database snap , Generated report snap and Vb.net program for your reference.
Please let me know your suggestions So,it will resolve my issue.
01 .DatabseImage
02.Generated Report
Imports System.Data
Imports System.Data.SqlClient
' For th is need to add Microsoft Excel componant from project > Add Ref > Com
Imports Excelr = Microsoft.Office.Interop.Excel
Module Module1
Dim conn As SqlConnection
Dim path As String = "C:mysettxtupConnectionstring.txt"
Dim objectreader As New System.IO.StreamReader(path)
Dim connetionString As String
Dim adpt As New SqlDataAdapter
Dim ds As New DataSet
' used for excel report
Dim r, c As Integer
Private Sub releaseObject(ByVal obj As Object)
Try
System.Runtime.InteropServices.Marshal.ReleaseComObject(obj)
obj = Nothing
Catch ex As Exception
obj = Nothing
Finally
GC.Collect()
End Try
End Sub
Sub Main()
'----- Read SQl Connection from Text File------
connetionString = objectreader.ReadLine
conn = New SqlConnection(connetionString)
'Dim trn_Log1, trn_Log2 As ADODB.Recordset
'************************************************************************************************************
' Set the Format type and the CustomFormat string.
'Start date
' DateTimePickerST.Format = DateTimePickerFormat.Custom
' DateTimePickerST.CustomFormat = "MM/dd/yyyy H:mm"
'Clear connection and dataset before open
conn.Close()
ds.Clear()
'To handle exception use here Try catach
Try
'Open connection
conn.Open()
'Dim query As String
' Dim query As String = "Select * from ProDataTbl1Sec where Date_Time between '" & RStartDate.Text & "'and'" & REndDate.Text & "'order by date_time asc"
Dim query As String = "SELECT * FROM ProDataTbl1Sec WHERE Date_Time >= dateadd(hour,-24,getdate())"
'Dim query As String = "SELECT * FROM ProDataTbl1Sec"
adpt.SelectCommand = New SqlCommand(query, conn)
ds = New DataSet("wincc")
adpt.Fill(ds)
Dim i, j As Integer
' Standard for Excel application
Dim xlApp As Excelr.Application
Dim xlWorkBook As Excelr.Workbook
Dim xlWorkSheet As Excelr.Worksheet
'Dim shXL As Excel.Worksheet
'xlWorkSheet.Visible = True
Dim misValue As Object = System.Reflection.Missing.Value
' Dim xlSourceRange As Excel.Range
xlApp = New Excelr.Application
' ------- Read Sample Report Location from Text file ------
'Dim path As String = "C:Pallmysetupconnectionstring.txt"
'Dim objectreader As New System.IO.StreamReader(path)
'connetionString = objectreader.ReadLine
'conn = New SqlConnection(connetionString)
Dim Srpath As String = "C:mysettxtupsamplereport.txt"
Dim Srobjectreader As New System.IO.StreamReader(Srpath)
Dim Srpathstring As String = Srobjectreader.ReadLine
' ------- Read Sample Report Location from Text file ------
xlWorkBook = xlApp.Workbooks.Add(Srpathstring & "SampleReport")
' ------- Save as Report Location from Text file ------
Dim Slrpath As String = "C:mysettxtupSavereport.txt"
Dim Slrobjectreader As New System.IO.StreamReader(Slrpath)
Dim Slrpathstring As String = Slrobjectreader.ReadLine
'xlWorkSheet = xlWorkBook.Sheets("D:PallReportSampleReport")
xlWorkSheet = xlWorkBook.Sheets("Report")
r = ds.Tables(0).Rows.Count + 7 ' 7 add here because we start 1 record from 8th row
c = ds.Tables(0).Columns.Count
Console.WriteLine(r)
Console.WriteLine(c)
Console.WriteLine("Work in Process")
' Print Table Row with column of worksheet
For i = 0 To ds.Tables(0).Rows.Count - 1
'For j = 0 To ds.Tables(0).Columns.Count - 1
For j = 0 To ds.Tables(0).Columns.Count - 1
xlWorkSheet.Cells(i + 8, j + 1) = ds.Tables(0).Rows(i).Item(j)
xlWorkSheet.Columns("A:I").EntireColumn.AutoFit()
'xlWorkSheet.Columns("A").EntireColumn.farmat()
Next
Console.WriteLine(i)
Next
' Save Excel Sheet
'~~> Save Worksheet file to the following location
'xlWorkSheet.SaveAs("E:VBReportvbexcel_" + currentdate.ToString() + "xlsx")
Dim currentdate As String = String.Format("0:ddMMyyyy-Hmm ", DateTime.Now)
' Excel Animation
'xlWorkSheet.Columns("A:I").EntireColumn.AutoFit()
With xlWorkSheet
.Range("A2").Value() = "Date : " & currentdate
End With
' ------- Save as Report Location from Text file ------
'RLocation.Text = " Report save in " & Slrpathstring
xlWorkSheet.SaveAs(Slrpathstring & "ParagDailyReport_" & currentdate & ".xlsx")
xlWorkBook.Close()
xlApp.Quit()
releaseObject(xlApp)
releaseObject(xlWorkBook)
releaseObject(xlWorkSheet)
'close connection , dadaptor and clear dataset
conn.Close()
adpt.Dispose()
ds.Dispose()
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End Sub
End Module
sql-server excel sql-server-2008-r2 ado.net
I am going to Log my process parameters in SQL and generate Excel Reports.
The Programming is done in VB.Net
we are going to log Date_Time in 'YYYY-MM-DD HH:mm:ss.ms' example:'2018-11-27 21:41:24.170' (Here ms is milisec.)
But while exporting with excel it comes in '27/11/18 21:41:24.000' not able to show millisecond data(here it is .170) .
So, Can you please let me know how i can show date&Time including millisecond in Excel.
Excel Setting for Date Column : dd/mm/yy hh:mm:ss.000
Please find Database snap , Generated report snap and Vb.net program for your reference.
Please let me know your suggestions So,it will resolve my issue.
01 .DatabseImage
02.Generated Report
Imports System.Data
Imports System.Data.SqlClient
' For th is need to add Microsoft Excel componant from project > Add Ref > Com
Imports Excelr = Microsoft.Office.Interop.Excel
Module Module1
Dim conn As SqlConnection
Dim path As String = "C:mysettxtupConnectionstring.txt"
Dim objectreader As New System.IO.StreamReader(path)
Dim connetionString As String
Dim adpt As New SqlDataAdapter
Dim ds As New DataSet
' used for excel report
Dim r, c As Integer
Private Sub releaseObject(ByVal obj As Object)
Try
System.Runtime.InteropServices.Marshal.ReleaseComObject(obj)
obj = Nothing
Catch ex As Exception
obj = Nothing
Finally
GC.Collect()
End Try
End Sub
Sub Main()
'----- Read SQl Connection from Text File------
connetionString = objectreader.ReadLine
conn = New SqlConnection(connetionString)
'Dim trn_Log1, trn_Log2 As ADODB.Recordset
'************************************************************************************************************
' Set the Format type and the CustomFormat string.
'Start date
' DateTimePickerST.Format = DateTimePickerFormat.Custom
' DateTimePickerST.CustomFormat = "MM/dd/yyyy H:mm"
'Clear connection and dataset before open
conn.Close()
ds.Clear()
'To handle exception use here Try catach
Try
'Open connection
conn.Open()
'Dim query As String
' Dim query As String = "Select * from ProDataTbl1Sec where Date_Time between '" & RStartDate.Text & "'and'" & REndDate.Text & "'order by date_time asc"
Dim query As String = "SELECT * FROM ProDataTbl1Sec WHERE Date_Time >= dateadd(hour,-24,getdate())"
'Dim query As String = "SELECT * FROM ProDataTbl1Sec"
adpt.SelectCommand = New SqlCommand(query, conn)
ds = New DataSet("wincc")
adpt.Fill(ds)
Dim i, j As Integer
' Standard for Excel application
Dim xlApp As Excelr.Application
Dim xlWorkBook As Excelr.Workbook
Dim xlWorkSheet As Excelr.Worksheet
'Dim shXL As Excel.Worksheet
'xlWorkSheet.Visible = True
Dim misValue As Object = System.Reflection.Missing.Value
' Dim xlSourceRange As Excel.Range
xlApp = New Excelr.Application
' ------- Read Sample Report Location from Text file ------
'Dim path As String = "C:Pallmysetupconnectionstring.txt"
'Dim objectreader As New System.IO.StreamReader(path)
'connetionString = objectreader.ReadLine
'conn = New SqlConnection(connetionString)
Dim Srpath As String = "C:mysettxtupsamplereport.txt"
Dim Srobjectreader As New System.IO.StreamReader(Srpath)
Dim Srpathstring As String = Srobjectreader.ReadLine
' ------- Read Sample Report Location from Text file ------
xlWorkBook = xlApp.Workbooks.Add(Srpathstring & "SampleReport")
' ------- Save as Report Location from Text file ------
Dim Slrpath As String = "C:mysettxtupSavereport.txt"
Dim Slrobjectreader As New System.IO.StreamReader(Slrpath)
Dim Slrpathstring As String = Slrobjectreader.ReadLine
'xlWorkSheet = xlWorkBook.Sheets("D:PallReportSampleReport")
xlWorkSheet = xlWorkBook.Sheets("Report")
r = ds.Tables(0).Rows.Count + 7 ' 7 add here because we start 1 record from 8th row
c = ds.Tables(0).Columns.Count
Console.WriteLine(r)
Console.WriteLine(c)
Console.WriteLine("Work in Process")
' Print Table Row with column of worksheet
For i = 0 To ds.Tables(0).Rows.Count - 1
'For j = 0 To ds.Tables(0).Columns.Count - 1
For j = 0 To ds.Tables(0).Columns.Count - 1
xlWorkSheet.Cells(i + 8, j + 1) = ds.Tables(0).Rows(i).Item(j)
xlWorkSheet.Columns("A:I").EntireColumn.AutoFit()
'xlWorkSheet.Columns("A").EntireColumn.farmat()
Next
Console.WriteLine(i)
Next
' Save Excel Sheet
'~~> Save Worksheet file to the following location
'xlWorkSheet.SaveAs("E:VBReportvbexcel_" + currentdate.ToString() + "xlsx")
Dim currentdate As String = String.Format("0:ddMMyyyy-Hmm ", DateTime.Now)
' Excel Animation
'xlWorkSheet.Columns("A:I").EntireColumn.AutoFit()
With xlWorkSheet
.Range("A2").Value() = "Date : " & currentdate
End With
' ------- Save as Report Location from Text file ------
'RLocation.Text = " Report save in " & Slrpathstring
xlWorkSheet.SaveAs(Slrpathstring & "ParagDailyReport_" & currentdate & ".xlsx")
xlWorkBook.Close()
xlApp.Quit()
releaseObject(xlApp)
releaseObject(xlWorkBook)
releaseObject(xlWorkSheet)
'close connection , dadaptor and clear dataset
conn.Close()
adpt.Dispose()
ds.Dispose()
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End Sub
End Module
sql-server excel sql-server-2008-r2 ado.net
sql-server excel sql-server-2008-r2 ado.net
edited Mar 27 at 17:38
Sean Lange
27.4k2 gold badges20 silver badges35 bronze badges
27.4k2 gold badges20 silver badges35 bronze badges
asked Mar 26 at 13:56
Manish ChoudhariManish Choudhari
11 bronze badge
11 bronze badge
migrated from dba.stackexchange.com Mar 27 at 17:34
This question came from our site for database professionals who wish to improve their database skills and learn from others in the community.
migrated from dba.stackexchange.com Mar 27 at 17:34
This question came from our site for database professionals who wish to improve their database skills and learn from others in the community.
migrated from dba.stackexchange.com Mar 27 at 17:34
This question came from our site for database professionals who wish to improve their database skills and learn from others in the community.
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55383371%2fneed-datetime-with-millisecond-while-generating-excel-report%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55383371%2fneed-datetime-with-millisecond-while-generating-excel-report%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown