Rahmat Faisal

Local GL INDC - Bali

See also: Other Geeks@INDC

September 2006 - Posts

Private Sub CetakData()

Dim cn As New SqlClient.SqlConnection("Integrated Security=False;Data Source=srv;Initial Catalog=tbl;User ID=user;Password=pwd;")

Dim strsql As String

Sub CetakData()

Dim cn As New SqlClient.SqlConnection("Integrated Security=False;Data Source=srv;Initial Catalog=tbl;User ID=user;Password=pwd;")

Dim strsql As String

Dim cn As New SqlClient.SqlConnection("Integrated Security=False;Data Source=srv;Initial Catalog=tbl;User ID=user;Password=pwd;")

Dim strsql As String

Dim strsql As String

Dim ds As New dsLineSheet

Dim getImage As New clsGetImageData

cn.Open()

strsql = "Select ItemID,ItemCode,ItemSize,Status,LastStatusDate,SalesGroup,SalesGroupDate,Market,Collection,CollectionDesc,ShortDesc,RetailPrice,WSPrice,comp_name from vwLineSheet where comp_name = host_name()"

Dim ds As New dsLineSheet

Dim getImage As New clsGetImageData

cn.Open()

strsql = "Select ItemID,ItemCode,ItemSize,Status,LastStatusDate,SalesGroup,SalesGroupDate,Market,Collection,CollectionDesc,ShortDesc,RetailPrice,WSPrice,comp_name from vwLineSheet where comp_name = host_name()"

Dim getImage As New clsGetImageData

cn.Open()

strsql = "Select ItemID,ItemCode,ItemSize,Status,LastStatusDate,SalesGroup,SalesGroupDate,Market,Collection,CollectionDesc,ShortDesc,RetailPrice,WSPrice,comp_name from vwLineSheet where comp_name = host_name()"

"Select ItemID,ItemCode,ItemSize,Status,LastStatusDate,SalesGroup,SalesGroupDate,Market,Collection,CollectionDesc,ShortDesc,RetailPrice,WSPrice,comp_name from vwLineSheet where comp_name = host_name()"

Dim dr As SqlClient.SqlDataReader

Dim cmd As SqlClient.SqlCommand = New SqlClient.SqlCommand(strsql, cn)

Dim drw As DataRow

Dim i As Integer = 0

dr = cmd.ExecuteReader

ds.Tables("vwLineSheet").Clear()

Do

Dim dr As SqlClient.SqlDataReader

Dim cmd As SqlClient.SqlCommand = New SqlClient.SqlCommand(strsql, cn)

Dim drw As DataRow

Dim i As Integer = 0

dr = cmd.ExecuteReader

ds.Tables("vwLineSheet").Clear()

Do

Dim cmd As SqlClient.SqlCommand = New SqlClient.SqlCommand(strsql, cn)

Dim drw As DataRow

Dim i As Integer = 0

dr = cmd.ExecuteReader

ds.Tables("vwLineSheet").Clear()

Do

Dim drw As DataRow

Dim i As Integer = 0

dr = cmd.ExecuteReader

ds.Tables("vwLineSheet").Clear()

Do

Dim i As Integer = 0

dr = cmd.ExecuteReader

ds.Tables("vwLineSheet").Clear()

Do

"vwLineSheet").Clear()

Do

Do

Do Until dr.Read = False

Do Until dr.Read = False

drw = ds.Tables("vwLineSheet").NewRow()

For i = 0 To dr.FieldCount - 1

drw(i) = dr(i)

Next

"vwLineSheet").NewRow()

For i = 0 To dr.FieldCount - 1

drw(i) = dr(i)

Next

For i = 0 To dr.FieldCount - 1

drw(i) = dr(i)

Next

Next

Try

Try

drw(dr.FieldCount) = getImage.GetImageData("Images\" & ds.Tables("vwLineSheet").Rows(0)("ItemCode") & ".jpg")

Catch ex As Exception

drw(dr.FieldCount) = getImage.GetImageData("\Images\na.jpg")

End Try

"Images\" & ds.Tables("vwLineSheet").Rows(0)("ItemCode") & ".jpg")

Catch ex As Exception

drw(dr.FieldCount) = getImage.GetImageData("\Images\na.jpg")

End Try

Catch ex As Exception

drw(dr.FieldCount) = getImage.GetImageData("\Images\na.jpg")

End Try

"\Images\na.jpg")

End Try

End Try

ds.Tables("vwLineSheet").Rows.Add(drw)

Loop

"vwLineSheet").Rows.Add(drw)

Loop

Loop

Loop While dr.NextResult = True

Loop While dr.NextResult = True

If Me.rbGroup.Checked = True Then

If Me.rbGroup.Checked = True Then

Me.rptLineSheet_Group1.SetDataSource(ds)

Me.CrystalReportViewer1.ReportSource = rptLineSheet_Group1

Else

Me.rptLineSheet_Group1.SetDataSource(ds)

Me.CrystalReportViewer1.ReportSource = rptLineSheet_Group1

Else

Me.CrystalReportViewer1.ReportSource = rptLineSheet_Group1

Else

Else

Me.rptLineSheet1.SetDataSource(ds)

Me.CrystalReportViewer1.ReportSource = rptLineSheet1

End If

Me.rptLineSheet1.SetDataSource(ds)

Me.CrystalReportViewer1.ReportSource = rptLineSheet1

End If

Me.CrystalReportViewer1.ReportSource = rptLineSheet1

End If

End If

dr.Close()

cmd.Dispose()

cn.Close()

End Sub

End Sub

 

Public Class clsGetImageData

Public Function GetImageData(ByVal fileName As String) As Byte()

Dim hasil As Byte()

'Method to load an image from disk and return it as a bytestream

Class clsGetImageData

Public Function GetImageData(ByVal fileName As String) As Byte()

Dim hasil As Byte()

'Method to load an image from disk and return it as a bytestream

Public Function GetImageData(ByVal fileName As String) As Byte()

Dim hasil As Byte()

'Method to load an image from disk and return it as a bytestream

Dim hasil As Byte()

'Method to load an image from disk and return it as a bytestream

'Method to load an image from disk and return it as a bytestream

If System.IO.File.Exists(fileName) = False Then

If System.IO.File.Exists(fileName) = False Then

fileName = "\\192.168.1.1\Images\na.jpg"

"\\192.168.1.1\Images\na.jpg"

End If

End If

'HttpContext.Current.Response.Write(fileName)

'HttpContext.Current.Response.Write(fileName)

Dim fs As System.IO.FileStream = _

New System.IO.FileStream(fileName, _

System.IO.FileMode.Open, IO.FileAccess.Read)

Dim br As System.IO.BinaryReader = New System.IO.BinaryReader(fs)

hasil = br.ReadBytes(Convert.ToInt32(br.BaseStream.Length))

fs.Dispose()

fs.Close()

br.Close()

Return hasil

End Function

End Class

Dim fs As System.IO.FileStream = _

New System.IO.FileStream(fileName, _

System.IO.FileMode.Open, IO.FileAccess.Read)

Dim br As System.IO.BinaryReader = New System.IO.BinaryReader(fs)

hasil = br.ReadBytes(Convert.ToInt32(br.BaseStream.Length))

fs.Dispose()

fs.Close()

br.Close()

Return hasil

End Function

End Class

New System.IO.FileStream(fileName, _

System.IO.FileMode.Open, IO.FileAccess.Read)

Dim br As System.IO.BinaryReader = New System.IO.BinaryReader(fs)

hasil = br.ReadBytes(Convert.ToInt32(br.BaseStream.Length))

fs.Dispose()

fs.Close()

br.Close()

Return hasil

End Function

End Class

Dim br As System.IO.BinaryReader = New System.IO.BinaryReader(fs)

hasil = br.ReadBytes(Convert.ToInt32(br.BaseStream.Length))

fs.Dispose()

fs.Close()

br.Close()

Return hasil

End Function

End Class

Return hasil

End Function

End Class

End Function

End Class

Class
Share this post: | | | |
Posted by Rahmat.Faisal | 2 comment(s)
Filed under:
<asp:RegularExpressionValidator runat="server" ErrorMessage="Only picture files are allowed!" ValidationExpression="^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+(.gif|.GIF|.jpg|.JPG|.jpeg|.JPEG)$" ControlToValidate="fileUpload" Display="None"></asp:RegularExpressionValidator>
Share this post: | | | |
Posted by Rahmat.Faisal | 2 comment(s)
Filed under: