Showing posts with label VB.NET Developer. Show all posts
Showing posts with label VB.NET Developer. Show all posts

How to create class file in Asp.Net ?


Sunday, July 25, 2010

Hi,

You can just add App_Code file and add class file to this folder and copy this code to that class file and modify according to your need.

using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using commonlib.Common;

/// <summary>
/// Summary description for Program
/// </summary>
public class Program
{
    #region "Fields"

    string sOperation;
    int iProgramID;
    string sProgramName;
    string sSlogan;
    string sStartTime;
    string sEndTime;
    string sDetail;
    int iCityID;
    string sStatus;

    #endregion

    #region "Construtor"
    public Program()
    {
    }

    public Program(string SOperation, int IProgramID, string SProgramName, string SSlogan, string SStartTime, string SEndTime, string SDetail, int ICityID, string SStatus)
    {
        this.sOperation = SOperation;
        this.iProgramID = IProgramID;
        this.sProgramName = SProgramName;
        this.sSlogan = SSlogan;
        this.sStartTime = SStartTime;
        this.sEndTime = SEndTime;
        this.sDetail = SDetail;
        this.iCityID = ICityID;
        this.sStatus = SStatus;
    }
    #endregion

    #region "Properties"

    public string SOperation
    {
        get { return sOperation; }
        set { sOperation = value; }
    }

    public int IProgramID
    {
        get { return iProgramID; }
        set { iProgramID = value; }
    }

    public string SProgramName
    {
        get { return sProgramName; }
        set { sProgramName = value; }
    }

    public string SSlogan
    {
        get { return sSlogan; }
        set { sSlogan = value; }
    }

    public string SStartTime
    {
        get { return sStartTime; }
        set { sStartTime = value; }
    }

    public string SEndTime
    {
        get { return sEndTime; }
        set { sEndTime = value; }
    }

    public string SDetail
    {
        get { return sDetail; }
        set { sDetail = value; }
    }

    public int ICityID
    {
        get { return iCityID; }
        set { iCityID = value; }
    }

    public string SStatus
    {
        get { return sStatus; }
        set { sStatus = value; }
    }

    #endregion

    #region "Functions"

    public int ProgramOperation(string user, string pass)
    {

        SqlConnection conn = new SqlConnection("Data Source=localhost;Database=MyDB;Integrated Security=SSPI");
        SqlCommand command = new SqlCommand("XYZ_SP_CheckProgramAvailability", conn);
        command.CommandType = CommandType.StoredProcedure;
        command.Parameters.Add("@User", SqlDbType.VarChar).Value = user;
        command.Parameters.Add("@Pass", SqlDbType.VarChar).Value = pass;
        conn.Open();
        int rows = command.ExecuteNonQuery();
        conn.Close();

    }

    #endregion
}


Hope this post will help you,
if yes please put comment below of this page,
Rajesh Singh,
Senior Asp.Net Developer

e-Procurement Technologies Ltd (India)
www.abcprocure.com



Steps to Create Crystal Report in VB.NET


Thursday, March 25, 2010

In this tutorail, I will teach you how to make crystal report in vb.net.

Please follow the Steps to Create Crystal Report in VB.NET,

Step 1: Create one vb.net project in visual studio.

Step 2: what we need to create simple crystal report ?
a.Dataset file (.xsd)
b.Crystal Report (.rpt)
c.One window form (.vb)


Crystal report by Induway Technologies (www.induway.com)


Step 3: Right click on project name in visual studio and click on add to add new items.

Step 4: Select Dataset from the list from Add New Item displayed box.
Name it as ReportDS as shown in Video.
Then you will be prompt with gray screen, it shows you have created dataset properly.
Drag Table from the Server explorer and drop it on dataset gray screen.


Step 5: Now its time to insert report file (.rtp), right click on project name in visual studio and click on add to add new items.

Step 6: Select CrystalReport from the list from Add new item displayed box.
Name it as Crystalreport1 as shown in video.
Then you will be prompt with the Crystal Reports Gallery,
Just click on "OK", then another page "Standard Report creation Wizard" will be prompted.
Then you need to select the database you created, in step 4.
For that click on ADO.NET Dataset and select you dataset from the list.as shown in video.
Then you will be prompted with table with fields, select the fields you require to show in report.
Then click on finish, and you have done.

Step 7: Now you need to add from to show this report in it. To do that, just add new form (.vb), and drag the Reportviewer form the data section in tool box.

Step 8: Take one button in that from, so that, when you click on that button, the report show appear.

Step 9: Then on click event of that button, paste this code below.

Dim conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=PAMDB.mdb;User Id=admin;Password=;")
Dim cmd As OleDbCommand
cmd = New OleDbCommand("SELECT PAM_Medical_Information.tPatientName, PAM_Medical_Information.tDoctorCareProvider, PAM_Type_of_Medical_Entry.tMedicalTypeName, PAM_Medical_Information.tRx_OTC_MedsList_Dosage_Frequency, format(PAM_Medical_Information.dMedicalDate,'MM/dd/yyyy') as dMedicalDate , iif (PAM_Medical_Information.tPutOnMedicalInformationCard = '1', 'Yes', 'No') as tPutOnMedicalInformationCard FROM PAM_Medical_Information INNER JOIN PAM_Type_of_Medical_Entry ON PAM_Medical_Information.nMedicalTypeID = PAM_Type_of_Medical_Entry.iMedicalTypeID", conn) ' Change ID

Dim da As New OleDbDataAdapter(cmd)
Dim ds As New DataSet() 'Set TypeDataset name That I have created before
da.Fill(ds, "MedicalList")
If (ds IsNot Nothing And ds.Tables(0).Rows.Count > 0) Then
Dim cryRpt1 As New ReportDocument
Dim reportpath As String = Application.StartupPath & "\Reports\Medical.rpt"
'cryRpt1.Load(reportpath)
cryRpt1.Load(reportpath)
cryRpt1.SetDataSource(ds.Tables(0))
CrystalReportViewer1.ReportSource = cryRpt1
CrystalReportViewer1.Refresh()
End If



Thats it, you have done finally, enjoy the report.

Hope this post will help you,
if yes please put comment below of this page,
Rajesh Singh,
Asp.Net Developer
Indianic Infotech Ltd (India)
rajesh@indianic.com


.

How to get @@Identity after insert operation in Access Database


Saturday, March 20, 2010

Solution :

I am going to explain this in Vb.Net.

Create one vb.net project and add one from frmAddContact.vb in your project.
and take one button and txtbox in that form.

Create Dataaccesslayer class file with name, DAL.vb

and add below code to respective files, please find the code below.


frmAddContact.vb

Dim ObjDataAccess As New DAL()
Public Class frmAddContact
Dim ObjDataAccess As New DAL()

Private Sub btnsave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsave.Click

Dim iRelationID As New Integer
iRelationID = ObjDataAccess.ExecuteNonQueryGetIdentity("INSERT INTO PAM_Relationship ( tRelationshipName,dCreatedDate,dModifiedDate) VALUES ('" & _
cmbrelationship.Text.Trim() & "',#" & _
Date.Now & "#,#" & _
Date.Now & "# )")

End Sub
End Class





DAL.vb

Imports System.Data.SqlClient
Imports System.Data
Imports System.Data.OleDb

Public Class DAL
Dim ConnStr As String = Configuration.ConfigurationSettings.AppSettings("DBConn").ToString()

Public Function ExecuteNonQueryGetIdentity(ByVal Query As String) As Integer

Dim iResult As Integer
Try
Dim Conn As New OleDb.OleDbConnection(ConnStr)
Conn.Open()
Dim cmd As New OleDb.OleDbCommand(Query, Conn)

cmd.ExecuteNonQuery()
cmd.CommandText = "Select @@Identity"
iResult = cmd.ExecuteScalar()
Conn.Close()
cmd.Dispose()
Catch ex As Exception
ex = Nothing
End Try

Return iResult
End Function

End Class


After insert operation, when you will check the value of return value of iRelationID, you will find the inserted row id.


Hope this post will help you,
if yes please put comment below of this page,
Rajesh Singh,
Asp.Net Developer
Indianic Infotech Ltd (India)
rajesh@indianic.com


.

How to upload zip file on blogger ?


Monday, October 26, 2009

Answer :

you can't upload any file directly to your blog.but you can achive this by indirectly, Please

read to find simple and free method to upload zip file on blogger.


Create account in this site :

http://www.4shared.com/signup.jsp


Just enter your email address and click on signup with FREE account

Then a virtual directory will be appered in front of you

http://www.4shared.com/account/dir/22327988/fd9c2607/sharing.html?rnd=46


Below you can see, upload file option, you can use that and upload your zip,image or any file
which you wanted, the user should download from your blog.

After uploading that file, you will see that file will appeared in the virtual directory.
then to get download link, you just click on download icon shown at the end of your file in

that virtual directory.

After clicking on that link, you will find this page

http://www.4shared.com/file/143676923/93c0c852/paypal_credit_card_processing_payment_gateway.html?signout=1


click on download, dont worry, the download will not start, this is to get download link.

after clicking on download button, you will see this page, counting download time in

decremently..

http://www.4shared.com/get/143676923/93c0c852/paypal_credit_card_processing_payment_gateway.html


then right click on this link "Click here to download this file" and click on "copy link

location".

open notepad and paste copied link.

i.e copied link ->


http://dc170.4shared.com/download/143676923/93c0c852/paypal_credit_card_processing_payment_gateway.zip?tsid=20091026-010849-1eccccca



How to use this download link in your blog

use this HTML code in your blog

&lt;a id="downloadid" src="http://dc170.4shared.com/download/143676923/93c0c852/paypal_credit_card_processing_payment_gateway.zip?tsid=20091026-010849-1eccccca" &gt;Download Source Code&lt;/a&gt;


when the user will click on this download link, the download will start from your blog without

visiting to other site.

Click here to see Demo


Hope this post will help you,
if yes please put comment below of this page,
Rajesh Singh,
Asp.Net Developer
Indianic Infotech Ltd (India)
rajesh@indianic.com

List of Test Credit Card Numbers


Thursday, October 22, 2009




credit cards images

Card Type

Card Number

American Express

378282246310005

American Express

371449635398431

American Express Corporate

378734493671000

Australian BankCard

5610591081018250

Diners Club

30569309025904

Diners Club

38520000023237

Discover

6011111111111117

Discover

6011000990139424

JCB

3530111333300000

JCB

3566002020360505

MasterCard

5555555555554444

MasterCard

5105105105105100

Visa

4111111111111111

Visa

4012888888881881

Visa

4222222222222

Note : Even though this number has a different character count than the other test numbers, it is the correct and functional number.

Processor-specific Cards

Dankort (PBS)

76009244561

Dankort (PBS)

5019717010103742

Switch/Solo (Paymentech)

6331101999990016




Hope this post will help you,
if yes please put comment below of this page,
Rajesh Singh,
Asp.Net Developer
Indianic Infotech Ltd (India)
rajesh@indianic.com