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 StringDim ds As New dsLineSheetDim getImage As New clsGetImageDatacn.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 dsLineSheetDim getImage As New clsGetImageDatacn.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 clsGetImageDatacn.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.SqlDataReaderDim cmd As SqlClient.SqlCommand = New SqlClient.SqlCommand(strsql, cn)Dim drw As DataRowDim i As Integer = 0dr = cmd.ExecuteReader
ds.Tables("vwLineSheet").Clear()Do
Dim dr As SqlClient.SqlDataReaderDim cmd As SqlClient.SqlCommand = New SqlClient.SqlCommand(strsql, cn)Dim drw As DataRowDim i As Integer = 0dr = cmd.ExecuteReader
ds.Tables("vwLineSheet").Clear()Do
Dim cmd As SqlClient.SqlCommand = New SqlClient.SqlCommand(strsql, cn)Dim drw As DataRowDim i As Integer = 0dr = cmd.ExecuteReader
ds.Tables("vwLineSheet").Clear()Do
Dim drw As DataRowDim i As Integer = 0dr = cmd.ExecuteReader
ds.Tables("vwLineSheet").Clear()Do
Dim i As Integer = 0dr = cmd.ExecuteReader
ds.Tables("vwLineSheet").Clear()Do
"vwLineSheet").Clear()Do
DoDo Until dr.Read = False
Do Until dr.Read = Falsedrw = ds.Tables("vwLineSheet").NewRow()For i = 0 To dr.FieldCount - 1drw(i) = dr(i)
Next
"vwLineSheet").NewRow()For i = 0 To dr.FieldCount - 1drw(i) = dr(i)
Next
For i = 0 To dr.FieldCount - 1drw(i) = dr(i)
Next
NextTry
Trydrw(dr.FieldCount) = getImage.GetImageData("Images\" & ds.Tables("vwLineSheet").Rows(0)("ItemCode") & ".jpg")Catch ex As Exceptiondrw(dr.FieldCount) = getImage.GetImageData("\Images\na.jpg")End Try
"Images\" & ds.Tables("vwLineSheet").Rows(0)("ItemCode") & ".jpg")Catch ex As Exceptiondrw(dr.FieldCount) = getImage.GetImageData("\Images\na.jpg")End Try
Catch ex As Exceptiondrw(dr.FieldCount) = getImage.GetImageData("\Images\na.jpg")End Try
"\Images\na.jpg")End Try
End Tryds.Tables("vwLineSheet").Rows.Add(drw)Loop
"vwLineSheet").Rows.Add(drw)Loop
LoopLoop While dr.NextResult = True
Loop While dr.NextResult = TrueIf Me.rbGroup.Checked = True Then
If Me.rbGroup.Checked = True ThenMe.rptLineSheet_Group1.SetDataSource(ds)Me.CrystalReportViewer1.ReportSource = rptLineSheet_Group1Else
Me.rptLineSheet_Group1.SetDataSource(ds)Me.CrystalReportViewer1.ReportSource = rptLineSheet_Group1Else
Me.CrystalReportViewer1.ReportSource = rptLineSheet_Group1Else
ElseMe.rptLineSheet1.SetDataSource(ds)Me.CrystalReportViewer1.ReportSource = rptLineSheet1End If
Me.rptLineSheet1.SetDataSource(ds)Me.CrystalReportViewer1.ReportSource = rptLineSheet1End If
Me.CrystalReportViewer1.ReportSource = rptLineSheet1End If
End Ifdr.Close()
cmd.Dispose()
cn.Close()
End Sub
End Sub
Public Class clsGetImageDataPublic 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 clsGetImageDataPublic 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 ThenfileName = "\\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 hasilEnd FunctionEnd 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 hasilEnd FunctionEnd 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 hasilEnd FunctionEnd 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 hasilEnd FunctionEnd Class
Return hasilEnd FunctionEnd Class
End FunctionEnd Class
Class
<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>