Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 SQL align issue

Author  Topic 

daniel50096230
Yak Posting Veteran

99 Posts

Posted - 2009-07-28 : 23:38:58
I had the following code to retrieve the data from database:




Dim objDB As New clsDB
Dim dsrepeater As New DataSet
Dim sql As String = [String].Empty

sql = "SELECT Top 93 [Content] FROM DC_VendorDetails_Temp "
sql &= "WHERE DCID='5AC469B3-D421-4B69-A1D6-E748CEE292EA' Order By LineNum;"

objDB.OpenDataSet(dsrepeater, sql)
dsrepeater.Tables(0).TableName = "DCAllowanceDetails"
dsrepeater.DataSetName = "DCAllowanceDetails"

Dim a As Integer = 0
lbl.Text = "<table width=""100%"">"
For a = 0 To dsrepeater.Tables(0).Rows.Count - 1



lbl.Text = lbl.Text & "<tr>"
lbl.Text = lbl.Text & "<td>" & dsrepeater.Tables(0).Rows(a).Item("Content").ToString()
lbl.Text = lbl.Text & "</td>"
lbl.Text = lbl.Text & "</tr>"
Next
lbl.Text = lbl.Text & "</table>"


But after I retrieve the data and display it on web, it looks something like this:



MENU 04.20.40 ZZ5042 5304 40 3070 DATE: FEB 11,09 PAGE: 1

Tesco Stores (Malaysia) TIME: 9:26 AM

SPECIAL ALLOWANCES REPORT - DETAIL



AUTO GENERATE VOUCHER : ALL

VENDOR NO : 00009 CLASSIC MODE SDN BHD CONTRACT : MR. TEOH CHEE KEONG DC CHAGE TYPE: MONTHLY

STORE NO : 908 FFDC SIMPANG PULAI (908) TEL : 03-90801311 FAX:03-90802611 FROM DATE : 01/01/09 TO DATE : 31/01/09

DEPT : 032 SEAFOOD



<-------RECEIPT--------> <---NEW STR DISC---> <---DC HAND CHRG---> <---X DOCK ALLOW---> <----BACKHAUL S----> <---DC ALLOWANCE---> <--------OTHER----> TOTAL <----- P/O ----->

G.R.N. DATE INV# DATE UNIT AMOUNT RATE AMOUNT RATE AMOUNT RATE AMOUNT RATE AMOUNT RATE AMOUNT RATE AMOUNT AMOUNT

--------------------------------------------------------------------------------------------------------------------------

0100 DRIED SEAFOOD



00235062 DRIED SCALLOP (S) 150GM PACKSIZ : 24 WEIGHT : .00 CUBE : .00

0000080843 01/01/09 24 396.00 0.00 .00 0.00 .00 0.90 .90 0.00 .00 0.00 .00 0.00 .00 .90

0000081311 04/01/09 72 1188.00 0.00 .00 0.00 .00 0.90 2.70 0.00 .00 0.00 .00 0.00 .00 2.70

0000081679 06/01/09 24 396.00 0.00 .00 0.00 .00 0.90 .90 0.00 .00 0.00 .00 0.00 .00 .90

0000082136 09/01/09 48 792.00 0.00 .00 0.00 .00 0.90 1.80 0.00 .00 0.00 .00 0.00 .00 1.80

0000082426 10/01/09 24 396.00 0.00 .00 0.00 .00 0.90 .90 0.00 .00 0.00 .00 0.00 .00 .90

0000083451 16/01/09 48 792.00 0.00 .00 0.00 .00 0.90 1.80 0.00 .00 0.00 .00 0.00 .00 1.80

0000083776 17/01/09 48 792.00 0.00 .00 0.00 .00 0.90 1.80 0.00 .00 0.00 .00 0.00 .00 1.80

0000084247 20/01/09 72 1188.00 0.00 .00 0.00 .00 0.90 2.70 0.00 .00 0.00 .00 0.00 .00 2.70

--------------------------------------------------------------------------------------------------------------------------

STYLE TOTAL 360 5940.00 .00 .00 13.50 .00 .00 .00 13.50





But from the database, it looks nicely and align nicely.For example, all the amount will align nicely to the header "Amount".
May I know is there any solution to make sure that the data that display on the web follow the alignment from database?Because in the database, the data is separate nicely with space and align nicely.
   

- Advertisement -