Skip to main content

Posts

Showing posts from September, 2008

SQL TRANSACTION

The below code perform sql transaction in VB.NET. We can use this code in C# also by making only some changes.


Try
con.Open()
trans = con.BeginTransaction
com.Transaction = trans
com.Connection = con

strSql = "Insert into Departments values('005','ABC')"
db.Save(strSql, com)

strSql = "Update Departments set department_name='EF' where department_code='002"
db.Save(strSql, com)
trans.Commit()
Catch ex As Exception
MsgBox(ex.Message)
trans.Rollback()
Finally
con.Close()
End Try

STRING CASES

To Capitalize all the characters in a string we use:

ucase( string_name )

To make all the characters of a string Small Letters we use:

lcase( string_name )

To Capitalize first letter of string we use:

StrConv( string_name , VbStrConv.ProperCase)

MessageBoxButtons.YesNo

To interact with user before saving any record or performing a very important operation we can re ask him through dialog result by following the below method.

Dim Buttons As Integer = MessageBoxButtons.YesNo

Dim Result As DialogResult

Result = MessageBox.Show(Me, Message, Caption, MessageBoxButtons.YesNo, _
MessageBoxIcon.Question, MessageBoxDefaultButton.Button1)


If Result = DialogResult.Yes Then
MessageBox.Show("You choosed Yes")
else
MessageBox.Show("You choosed No")
End If

Invalid KeyCodeV2.dll or KeyCodeV2.dll Not Found

The reason you are getting this error is because the machine that you are trying to run your application on does not contain the drivers Crystal Report needs to run. Here is your solution:

Finding Out What the Crystal Report Distribution Key is on VS.NET 2003:

1- Open VS.NET 2003
2- Click on Help Menu Option
3- Choose "About Microsoft Development Environment"
4- Look under Crystal Reports for Visual Studio .NET, you will see a 19 character number, which is the Distribution Key Code:

Example: AAA00-BB00000-C0000DD

Producing the Deployment Project:

Open Solution Explorer, right click on the “Solution Name” at the top and Add a New Project. On the window that appears, move to Setup and Deployment Projects. Click on Setup Project (not the wizard), put a name for your deployment project (make a note of the location where the folder that the deployment project will be created in) and then click OK. A File System dialog will appear – solution explorer should be displayed on the left of scr…

How to Use VLOOKUP or HLOOKUP to find an exact match

SUMMARY

The VLOOKUP and HLOOKUP functions contain an argument called range_lookup that allows you to find an exact match to your lookup value without sorting the lookup table.

Note It is not necessary to sort the lookup table if you use the range_lookup argument correctly.


MORE INFORMATION

The syntax of these functions are defined as follows.


VLOOKUP Function

=VLOOKUP(lookup_value,table_array,col_index_num,range_lookup)


where:

Argument Definition of argument
---------------------------------------------------------------------

lookup_value The value to be found in the first column of the array.

table_array The table of information in which data is looked up.

col_index The column number in the table_array for which the
matching value should be returned.

range_lookup It is a logical value that specifies whether
you want to find an exact match or an approximate match.
If TRUE or omitted, an approximate match is returned; in