mahalakshmi_s
asked on
write HTML file from VB.NET
Hi ,
I have my VB.NET writing the output in form of CSV file. Below is the code. It works fine and it gives me 20 records. Now I have to write the same content in form of HTML file with one thing extra. All the 20 rows will have one column "RecordIDFor1880" for which I have to give link. If user clicks it, it will open up some other page for which I know the path.
How can I achieve it?
Maha
Public Sub GenerateCSV()
Try
Dim OutputFileMSA As String = Application.StartupPath & "\CSVFiles\" & FirstLastName & ".csv"
Dim myFileStream As New System.IO.FileStream(Outpu tFileMSA, _
FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None)
'Create the stream writer
Dim OutputFNMSA As New System.IO.StreamWriter(myF ileStream)
OutputFNMSA.WriteLine("Cou nter" & "," & "CountFromBlockedSet" & "," & "RecordIDFor1880" & "," & "FIRSTNAME" & "," & "LASTNAME" & "," & "Total Score")
Dim connstr = "server=CSDAMAP1;uid=namem atch;pwd=n amematch;d atabase=Na meSearch;"
Dim sqlConn4 As New SqlConnection(connstr)
sqlConn4.Open()
Dim rsSort_sqlcomm As New SqlCommand("SELECT * from ScoreTableNoQuotes order by TotalScore Desc", sqlConn4)
Dim rsSortDR As SqlDataReader = rsSort_sqlcomm.ExecuteRead er()
Dim SortRecCount As Integer
SortRecCount = 1
While rsSortDR.Read()
If SortRecCount <= 20 Then
OutputFNMSA.WriteLine(Sort RecCount & "," & rsSortDR("CountFromBlocked Set") & "," & rsSortDR("RecordIDFor1880" ) & "," & rsSortDR("frstname") & "," & rsSortDR("lastname") & "," & rsSortDR("totalscore") & "," )
SortRecCount = SortRecCount + 1
Else
Exit While
End If
End While
OutputFNMSA.Close()
OutputFNMSA = Nothing
rsSortDR.Close()
rsSortDR = Nothing
sqlConn4.Close()
sqlConn4 = Nothing
Catch ex As Exception
MessageBox.Show(Err.Descri ption, vbCritical, "JaroWeight")
End Try
End Sub
I have my VB.NET writing the output in form of CSV file. Below is the code. It works fine and it gives me 20 records. Now I have to write the same content in form of HTML file with one thing extra. All the 20 rows will have one column "RecordIDFor1880" for which I have to give link. If user clicks it, it will open up some other page for which I know the path.
How can I achieve it?
Maha
Public Sub GenerateCSV()
Try
Dim OutputFileMSA As String = Application.StartupPath & "\CSVFiles\" & FirstLastName & ".csv"
Dim myFileStream As New System.IO.FileStream(Outpu
FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None)
'Create the stream writer
Dim OutputFNMSA As New System.IO.StreamWriter(myF
OutputFNMSA.WriteLine("Cou
Dim connstr = "server=CSDAMAP1;uid=namem
Dim sqlConn4 As New SqlConnection(connstr)
sqlConn4.Open()
Dim rsSort_sqlcomm As New SqlCommand("SELECT * from ScoreTableNoQuotes order by TotalScore Desc", sqlConn4)
Dim rsSortDR As SqlDataReader = rsSort_sqlcomm.ExecuteRead
Dim SortRecCount As Integer
SortRecCount = 1
While rsSortDR.Read()
If SortRecCount <= 20 Then
OutputFNMSA.WriteLine(Sort
SortRecCount = SortRecCount + 1
Else
Exit While
End If
End While
OutputFNMSA.Close()
OutputFNMSA = Nothing
rsSortDR.Close()
rsSortDR = Nothing
sqlConn4.Close()
sqlConn4 = Nothing
Catch ex As Exception
MessageBox.Show(Err.Descri
End Try
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.