This blog is most useful for Software Engineers, Database Administrators, QA and etc.
Dec 17, 2008
How to get week name in sql:sql/sql2005
RETURNS VARCHAR(10)
AS
BEGIN
DECLARE @rtDayofWeek VARCHAR(10)
DECLARE @weekDay INT
-- Here I have subtracted 7 For keeping Sunday as the First day
-- like wise for Monday we need to subtract 2 and so on
SET @weekDay = ((DATEPART(dw,@dtDate)+@@DATEFIRST-7)%7)
SELECT @rtDayofWeek = CASE @weekDay
WHEN 1 THEN 'Sunday'
WHEN 2 THEN 'Monday'
WHEN 3 THEN 'Tuesday'
WHEN 4 THEN 'Wednesday'
WHEN 5 THEN 'Thursday'
WHEN 6 THEN 'Friday'
WHEN 7 THEN 'Saturday'
END
RETURN (@rtDayofWeek)
END
GO
Dec 4, 2008
Nov 4, 2008
Removing Additional White-Spaces in Sentence (C#) « N Rao Lakkakula’s Blog
Nov 3, 2008
Oct 28, 2008
MS SQL 2005 identity lost new database - Database Journal Forums – Database Forum for Access, DB2, SQL, Oracle & More
creating a TABLE
CREATE TABLE [dbo].[TbTest](
[id_TbTest] [int] IDENTITY(1,1) NOT NULL PRIMARY KEY CLUSTERED ,
[Title] [varchar](100) NULL,
) ON [PRIMARY]
when looking at the Column Properties in MS Server Management Studio you can get :
Identity Specification = Yes
(Is Identity) = Yes
Increment = 1
Seed = 1
now if you want to make a copy of that database, importing data and tables
you will get :
Identity Specification = No
(Is Identity) = No
Solution
"It is impossible alter column to type IDENTITY directly, but you can do it in few steps:
ALTER TABLE [dbo].[TbTest] ADD
[id1_TbTest] [int] IDENTITY(1,1) NOT NULL PRIMARY KEY CLUSTERED;
ALTER TABLE [dbo].[TbTest] DROP COLUMN [id_TbTest];
EXEC sp_rename '[TbTest].[id1_TbTest]', 'id_TbTest', 'COLUMN';"
Oct 17, 2008
spot printing in c#
using System.Drawing.Printing;
using System.Drawing;
using System.IO;
namespace WindowsApplication1
{
public partial class Form3 : Form
{
private System.ComponentModel.Container components;
private System.Windows.Forms.Button printButton;
private Font printFont;
private StreamReader streamToPrint;
PrintDocument printDocument1 = new PrintDocument();
public Form3()
{
InitializeComponent();
printDocument1.PrintPage += printDocument1_PrintPage;
}
private void printButton_Click(object sender, EventArgs e)
{
using (PrintDialog pd = new PrintDialog())
{
if (pd.ShowDialog() == DialogResult.OK)
printDocument1.PrinterSettings = pd.PrinterSettings;
printDocument1.Print();
}
void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
Font objFont=new Font ("Microsoft Sans Serif", 10F);//sets the font type and size
float fTopMargin = e.MarginBounds.Top;
float fLeftMargin = 50;//sets left margin
float fRightMargin = e.MarginBounds.Right - 150;//sets right margin
string employee_id = String.Concat("EMPLOYEE ID:- ", comboBox2.Text);//prints EMPLOYEE ID:- and text in combobox2
string employee_name = String.Concat("EMPLOYEE NAME:- ", textBox8.Text);
e.Graphics.DrawString(employee_id, objFont, Brushes.Black, fLeftMargin, fTopMargin);
fTopMargin += objFont.GetHeight() * 2;//skip two lines
e.Graphics.DrawString(employee_name, objFont, Brushes.Black, fLeftMargin, fTopMargin);
objFont.Dispose();
e.HasMorePages = false;
}
Oct 16, 2008
Formatting Numbers/Leading zeros. - .NET C#
Oct 7, 2008
Multi Column ListView Control
Dim str(5) As String
Dim itm As ListViewItem
str(0) = 'Rob Machy'
str(1) = '100 North Ave'
str(2) = 'Business Manager'
str(3) = '89,000'
str(4) = 'Development'
itm = New ListViewItem(str)
c#:
string[] str=new string [2] ;
ListViewItem lsv;
str[0] = dtItems.Rows[i]["Prefix"].ToString();
str[1] = dtItems.Rows[i]["Priority"].ToString();
ListViewItem itm =new ListViewItem(str);
LstVU.Items.Add(itm);
Sep 24, 2008
Do not miss your data: the pitfalls of DATE and TIME in T-SQL. - Home
FROM Tmp_Orders
WHERE (CAST(FLOOR(CAST( OrderDate AS FLOAT )) AS DATETIME) BETWEEN '16-Jun-2008' AND '25-Jun-2008')
ORDER BY OrderDate;"
How to get Image from form resource:C#
Sep 16, 2008
Sep 12, 2008
Sep 9, 2008
Sep 5, 2008
Sep 4, 2008
Sep 2, 2008
Sep 1, 2008
Aug 30, 2008
Aug 27, 2008
Aug 26, 2008
Exporting crystal report as PDF and sending via email as attachment - Filename Issue? : Crystal Reports for Visual Studio : Visual Studio : MSDN Forums
Dim diskOpts As New CrystalDecisions.Shared.DiskFileDestinationOptions()
Dim ExpOpts As CrystalDecisions.Shared.ExportOptions
Dim MailOpts As New CrystalDecisions.Shared.MicrosoftMailDestinationOptions()
repdoc = Me.CrystalReport11
repdoc.Load('C:\Documents and Settings\User\My Documents\Visual Studio 2005\Projects\WindowsApplication3\WindowsApplication3\CrystalReport1.rpt')
ExpOpts = repdoc.ExportOptions
With ExpOpts
.ExportDestinationType = CrystalDecisions.[Shared].ExportDestinationType.MicrosoftMail
.ExportFormatType = CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat
End With
With MailOpts
.MailMessage = 'Message'
.MailToList = 'enter email adress here'
.MailSubject = 'Attached is a PDF file - .net Export test '
End With
ExpOpts.DestinationOptions = MailOpts
Try
repdoc.Export()
Catch err As Exception
MessageBox.Show(err.ToString())
End Try"
Crystalreport Tutorials' Sample Code Directory
In this online help, the tutorials provide detailed step procedures that guide you through the completion of complex tasks. The tutorials are also available as completed sample code. See Tutorials.
If you have installed Crystal Reports with the default settings and file paths, sample code is in the directories shown below.
Crystal Reports version | Path to tutorials' sample code |
---|---|
Crystal Reports 11 | C:\Program Files\Business Objects\Crystal Reports 11\Developer Files\Help\En\CR_NET_SDK_Tutorial_Sample_Code.zip |
Crystal Reports for Visual Studio 2005 | C:\Program Files\Microsoft Visual Studio 8\Crystal Reports\Samples\en\Code\TutorialSampleCodeProjects.msi |
Crystal Reports Basic for Visual Studio 2008 | C:\Program Files\Microsoft Visual Studio 9.0\Crystal Reports\Samples\En\Code\ |
Aug 19, 2008
Aug 18, 2008
Aug 15, 2008
Aug 14, 2008
How to search a directory and getting the directory path to connection string : c#
private void ResetConnectionString() { string dbDir = this.GetDBDirectory()+ @"\JSNorthWind.MDB"; this.nWindConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + dbDir + ";"; } private string GetDBDirectory() { System.IO.DirectoryInfo currentDirectory = new System.IO.DirectoryInfo(Application.ExecutablePath).Parent; while (currentDirectory!=null) { System.IO.DirectoryInfo[] childDirectories = currentDirectory.GetDirectories(); foreach(System.IO.DirectoryInfo childDir in childDirectories) { if(childDir.Name=="Data") { return childDir.FullName; } } currentDirectory = currentDirectory.Parent; } return ""; } |
Send instant messages to your online friends http://uk.messenger.yahoo.com
Aug 13, 2008
Aug 12, 2008
Aug 11, 2008
Aug 6, 2008
Aug 5, 2008
Aug 1, 2008
Jul 31, 2008
Jul 30, 2008
Jul 29, 2008
Jul 25, 2008
What is Outsourcing?
Jul 23, 2008
Jul 22, 2008
Jul 21, 2008
Jul 18, 2008
Jul 16, 2008
Jul 15, 2008
Jul 14, 2008
Jul 13, 2008
Jul 12, 2008
Jul 11, 2008
Jul 8, 2008
Jul 7, 2008
C# ( C Sharp) AIO: A Collection of 59 Bestsellers
Visual C# Recipes A Problem Solution Approach
Learning C Sharp 2nd Edition
C Sharp for Dummies
Visual C Sharp Express Edition Starter Kit
Programming C Sharp
Visual C Sharp A Developer’s Notebook
Pro C# and the .NET 2.0 Platform
Thomson Beginning C Sharp Game Programming
Course Technology PTR Beginning C# Game Programming
Elsevier Inc C# 2.0 Practical Guide For Programmers
C sharp Cookbook
C# Language Specification
C Sharp Threading Handbook
Course Technology PTR Beginning C# Game Programming
Dissecting a C# Application Inside SharpDevelop
The MIT Press C# Precisely
Elsevier Inc Network programming .NET with C# and VB.NET
Sams Teach Yourself the C# Language in 21 Days
Expert Service Oriented Architecture in C# Using the Web Services Enhancements 2
Microsoft Visual C Sharp Dot Net Unleashed
Professional C# Third Edition
C Sharp Design Patterns A Tutorial
Essential Asp Net With Examples In C Sharp
C Sharp and dotNET Framework The C Perspective
Windows Forms Programming in C#
The C# Programming Language
A Programmer’s Introduction to C#
C# for Java Developers
A Programmer e2 80 99s Guide to ADO.NET in C#
Database Programming with C#
Pearson C# Primer A Practical Approach
Microsoft C Sharp Programming for the Absolute Beginner
Data Entry and Validation with C# and VB .NET Windows Forms
Professional C# Design Patterns Applied
Sybex Mastering ASP.NET with C#
OOP with Microsoft Visual Basic .NET and Microsoft Visual C# Step By Step
Hungry Minds C# COM Programming
C# Bible
C Sharp Network Programming
Programming C# 2nd Edition
Teach Yourself Microsoft Visual C Sharp.NET In 24 Hours
C Sharp Class Design Handbook Coding Effective Classes
Syngress C# .net Web Developers Guide
Programming Microsoft Windows with C#
Syngress C# for Java Programmers
Premier Press Microsoft C# Professional Projects
Hungry Minds C# Your visual blueprint for building .NET applications .
Teach Yourself C# in 24 Hours
Sybex Visual C# ASP.NET Programming
Manning Windows Forms Programming with C#
Professional C Sharp 2nd Edition
Course Technology PTR Microsoft C# Programming For The Absolute Beginner
Sybex Mastering C Sharp Database Programming
C# How To Program
User Interfaces in C# Windows Forms and Custom Controls
C# How To Program
Advanced C# Programming
Jul 5, 2008
Jun 30, 2008
Jun 28, 2008
SQL-SCRIPT eSnips Folder
Jun 27, 2008
Decompile An Exe To Source Code - How to recognize it
Jun 24, 2008
Jun 23, 2008
Calling Win32 Api from C# - csharp
The following code shows a simple example of invoking a Win32 api.
The best way to use Win32 apis is to encapsulate it in a class module.
The namespace for COM interop is System.Runtime.InteropServices.
The method name should have DllImport attribute specifying the name of the dll. Here the dll is user32. Other dlls are Gdi and Kernel.
using System;
using System.Collection.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void cmdtam_Klik(object sender, EventArgs e)
{
string cstr;
cstr = "data source=jery;initial catalog=latihan;uid=sa;pwd=sri";
SqlConnection con1 = new SqlConnection(cstr);
con1.Open();
SqlCommand com1 = new SqlCommand();
com1.Connection = con1;
com1.CommandType = CommandType.Text;
com1.CommandText = "select * from customer"
DataSet ds1 = new DataSet();
SqlDataAdapter adp1 = new SqlDataAdapter(com1);
adp1.Fill(ds1,"customer");
grd1.DataMember = "customer";
con1.Close();
}
}
}
Microsoft SQL Server: Top 30 Features of SQL Server 2005
Ajaxload - Ajax loading gif generator
After needed an animated loading .gif image for a recent Ajax application I did some quick Google searching and came across a fantastic site: http://www.ajaxload.info/
Ajaxload allows you to generate your own animated Ajax loading images with a few simple click. Starting from a number of animation templates you can then choose a background and foreground colour for your new loading .gif. After 30 seconds of playing around, see some of my examples below:
Fantastic, yet simple. This is the way all websites you should be, well done Ajaxload.