TIPS N' SAMPLES
Useful tips and samples for software developers
Saturday, January 24, 2015
Useful Links - FTP Upload And Download
http://www.c-sharpcorner.com/UploadFile/d3e4b1/practical-approach-of-downloading-file-from-ftp-path/
http://www.c-sharpcorner.com/UploadFile/d3e4b1/practical-approach-of-uploading-file-to-ftp-path/
https://khanrahim.wordpress.com/2010/09/03/file-download-upload-delete-in-ftp-location-using-c/
http://www.codeproject.com/Tips/300226/Upload-file-to-server-using-ftp
http://www.codegain.com/articles/csharp/miscellaneous/download-file-from-ftp-server-using-c-sharp.aspx
http://www.codeproject.com/Articles/17202/Simple-FTP-demo-application-using-C-Net
http://www.dotnetbull.com/2011/09/uploading-files-from-client-side-to-ftp.html
http://www.c-sharpcorner.com/UploadFile/d3e4b1/practical-approach-of-uploading-file-to-ftp-path/
https://khanrahim.wordpress.com/2010/09/03/file-download-upload-delete-in-ftp-location-using-c/
http://www.codeproject.com/Tips/300226/Upload-file-to-server-using-ftp
http://www.codegain.com/articles/csharp/miscellaneous/download-file-from-ftp-server-using-c-sharp.aspx
http://www.codeproject.com/Articles/17202/Simple-FTP-demo-application-using-C-Net
http://www.dotnetbull.com/2011/09/uploading-files-from-client-side-to-ftp.html
Useful Links - Image handling in web
http://stackoverflow.com/questions/15519175/how-to-store-image-outside-of-the-websites-root-directory
http://www.aspsnippets.com/Articles/Displaying-images-that-are-stored-outside-the-Website-Root-Folder.aspx
http://forums.asp.net/t/1592633.aspx?Image+with+the+path+outside+project
http://stackoverflow.com/questions/24801672/how-to-get-an-image-from-external-shared-folder-openfiledialog
http://www.aspsnippets.com/Articles/Display-Images-in-GridView-Control-using-the-path-stored-in-SQL-Server-database.aspx
http://www.aspdotnet-suresh.com/2011/03/how-to-save-images-into-folder-and.html
http://hemantrautela.blogspot.com/2012/03/image-resize-in-aspnet-with-cnet.html
http://hemantrautela.blogspot.com/2013/10/upload-image-by-external-url-in-aspnet.html
Friday, October 24, 2014
Wednesday, May 14, 2014
DATAGRIDVIEW ROW FORMATING
SAMPLE:
Private Sub dgvData_CellFormatting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles dgvData.CellFormatting
If dgvData.DataSource IsNot Nothing Then
Dim drv As DataRowView
Dim dt As DataTable = CType(dgvData.DataSource, DataSet).Tables(0)
If e.RowIndex >= 0 Then
If e.RowIndex <= dt.Rows.Count - 1 Then
drv = dt.DefaultView.Item(e.RowIndex)
Dim dfm As Date
Dim dto As Date
dfm = drv.Item("Period From")
dto = drv.Item("Period Upto")
If Now.Date >= dfm And Now.Date <= dto Then
e.CellStyle.ForeColor = dgvData.DefaultCellStyle.ForeColor
Else
e.CellStyle.ForeColor = SystemColors.GrayText
End If
End If
End If
End If
End Sub
Private Sub dgvData_CellFormatting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles dgvData.CellFormatting
If dgvData.DataSource IsNot Nothing Then
Dim drv As DataRowView
Dim dt As DataTable = CType(dgvData.DataSource, DataSet).Tables(0)
If e.RowIndex >= 0 Then
If e.RowIndex <= dt.Rows.Count - 1 Then
drv = dt.DefaultView.Item(e.RowIndex)
Dim dfm As Date
Dim dto As Date
dfm = drv.Item("Period From")
dto = drv.Item("Period Upto")
If Now.Date >= dfm And Now.Date <= dto Then
e.CellStyle.ForeColor = dgvData.DefaultCellStyle.ForeColor
Else
e.CellStyle.ForeColor = SystemColors.GrayText
End If
End If
End If
End If
End Sub
Tuesday, February 25, 2014
@@IDENTITY vs SCOPE_IDENTITY() vs IDENT_CURRENT
@@IDENTITY
returns the id of the last thing that was inserted by your client's connection to the database.
Most of the time this works fine, but sometimes a trigger will go and
insert a new row that you don't know about, and you'll get the ID from
this new row, instead of the one you wantSCOPE_IDENTITY()
solves this problem. It returns the id of the last thing that you inserted in the SQL code you sent to the database. If triggers go and create extra rows, they won't cause the wrong value to get returned. IDENT_CURRENT
returns the last ID that was inserted by
anyone. If some other app happens to insert another row at an unforunate
time, you'll get the ID of that row instead of your one.Following code nicely work with Sql server 2005
DECLARE @last_id INT;
INSERT INTO [my_table] ([col1],[col2])
OUTPUT INSERTED.[id] INTO @last_id
VALUES (@col1,@col2)
More Info:
http://stackoverflow.com/questions/42648/best-way-to-get-identity-of-inserted-row
Friday, January 24, 2014
SUM OF A DATAGRIDVIEW CELL USING LINQ
SAMPLE:1
Dim qry0 = From theRow As DataGridViewRow In dgvData.Rows _
Select theRow
Dim t = qry0.Sum(Function(x As DataGridViewRow) x.Cells("Amount").Value)
** dgvData - Datagridview name "Anount" is column name
-----------------------------------------------------------------
SAMPLE:2
Dim qry1 = From theRow As DataGridViewRow In dgvData.Rows _
Where theRow.Cells("Year").Value > 2010 _
Select theRow
Dim t = qry1.Sum(Function(x As DataGridViewRow) x.Cells("Amount").Value)
Subscribe to:
Posts (Atom)