.NETGURU
Create Context
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngvb' list.


-- Moved from [aspngfreeforall] to [aspngvb] by Tim Musschoot <Click here to reveal e-mail address> --

Hi All ,
How to Create Context Object in ASP.NET ? In VB 6.0 , We are using COM+
Service Type Library (COMSVCS.DLL) . I have to use getcontext object in DLL.
So kindly suggest me How to get create context in VB.net

shatdal

-----Original Message-----
From: Ambati Srinivasalu [mailto:Click here to reveal e-mail address]
Sent: Monday, May 20, 2002 7:17 PM
To: aspngfreeforall
Subject: [aspngfreeforall] Passing Null Value to a method in a class

Hi,

How can I pass a "null" as a param to a method in a class which is expecting
a string or integer ?

Here is the sample code below

Thanks in advance

Srinivas

//************************ WEB APPLICATION *******************************

        public void LinkButtonInsert_Click(object src, EventArgs e)
        {
            try
            {
                dbCustomer objCustomer = new dbCustomer();
                if (objCustomer.Insert_Customer(1,
System.DBNull.Value))
                {
                    LabelMessage.Text = "New Customer
Inserted.";
                }
                else
                {
                    LabelMessage.Text = "New Customer
Insert Failed.";
                }
                showSearch();
            }
            catch (Exception Err)
            {
                //display error message
                LabelMessage.Text =
String.Concat(LabelMessage.Text, "showSearch: ", Err.Message, "<br>");
            }
        }

//************************ DATA ACCESS CLASS *******************************

using System;
using System.Security.Principal;
using System.Runtime.InteropServices;
using System.Data;
using System.Data.SqlClient;
using System.Xml;
using System.IO;
using System.IO.IsolatedStorage;

namespace DemoApplication
{
    /// <summary>
    /// Data Access Layer for Tbl_Customer.
    /// </summary>
    public class dbCustomer
    {
        public dbCustomer()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        public bool Insert_Customer (int CustomerID , string
CustomerName )

            SqlConnection dbConnection = new
SqlConnection("server=<DatabaseServer>;uid=<userid>;pwd=<password>;database=
<databaseName>");
            SqlCommand Cmd = new
SqlCommand("sp_Insert_Customer", dbConnection);
            Cmd.CommandType = CommandType.StoredProcedure;

            SqlParameter pCustomerID = new
SqlParameter("@CustomerID", SqlDbType.Int, 4);
            SqlParameter pCustomerName = new
SqlParameter("@CustomerName", SqlDbType.VarChar, 255);

            pCustomerID.Value = CustomerID;
            pCustomerName.Value = CustomerName;

            Cmd.Parameters.Add(pCustomerID);
            Cmd.Parameters.Add(pCustomerName);

            try
            {
                dbConnection.Open();
                Cmd.ExecuteNonQuery();
                dbConnection.Close();
                if (Convert.ToBoolean(pStatus.Value))
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            catch
            {
                return false;
            }
        }

    }
}

//************************ STORED PROCEDURE *******************************

CREATE PROCEDURE
.sp_Insert_Customer(
@CustomerID int ,
@CustomerName varchar(500) = NULL
)
AS

INSERT INTO Tbl_Customer(
CustomerID,
CustomerName
)
VALUES (
@CustomerID,
@CustomerName
)

GO

| ASP.net DOCS = http://www.aspng.com/docs
| [aspngfreeforall] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/aspngfreeforall = JOIN/QUIT
| news://ls.asplists.com = NEWSGROUP

Reply to this message...
 
    
Wally McClure
You will want to import the System.EnterpriseServices namespace. From there
you can use either AutoComplete or ContextUtil for the .SetComplete() or
.SetAbort() operations.

Wally

McClure Development
865-693-3004
118 Durwood Rd.
Knoxville, TN 37922
http://www.mccluredevelopment.com/
Building Scalable Applications with the Microsoft.NET Framework
http://www/scalabilitywith.net/
"Building Highly Scalable Database Applications with Microsoft.NET"
http://www.amazon.com/exec/obidos/ASIN/0764536400/qid=1020081583/sr=8-1/refsr_8_1_1/104-9726427-8447111

-----Original Message-----
From: Click here to reveal e-mail address [mailto:Click here to reveal e-mail address]
Sent: Monday, May 20, 2002 10:42 AM
To: aspngvb
Subject: [aspngvb] Create Context

-- Moved from [aspngfreeforall] to [aspngvb] by Tim Musschoot
<Click here to reveal e-mail address> --

Hi All ,
How to Create Context Object in ASP.NET ? In VB 6.0 , We are using COM+
Service Type Library (COMSVCS.DLL) . I have to use getcontext object in DLL.
So kindly suggest me How to get create context in VB.net

shatdal

-----Original Message-----
From: Ambati Srinivasalu [mailto:Click here to reveal e-mail address]
Sent: Monday, May 20, 2002 7:17 PM
To: aspngfreeforall
Subject: [aspngfreeforall] Passing Null Value to a method in a class

Hi,

How can I pass a "null" as a param to a method in a class which is expecting
a string or integer ?

Here is the sample code below

Thanks in advance

Srinivas

//************************ WEB APPLICATION *******************************

        public void LinkButtonInsert_Click(object src, EventArgs e)
        {
            try
            {
                dbCustomer objCustomer = new dbCustomer();
                if (objCustomer.Insert_Customer(1,
System.DBNull.Value))
                {
                    LabelMessage.Text = "New Customer
Inserted.";
                }
                else
                {
                    LabelMessage.Text = "New Customer
Insert Failed.";
                }
                showSearch();
            }
            catch (Exception Err)
            {
                //display error message
                LabelMessage.Text String.Concat(LabelMessage.Text, "showSearch: ", Err.Message, "<br>");
            }
        }

//************************ DATA ACCESS CLASS *******************************

using System;
using System.Security.Principal;
using System.Runtime.InteropServices;
using System.Data;
using System.Data.SqlClient;
using System.Xml;
using System.IO;
using System.IO.IsolatedStorage;

namespace DemoApplication
{
    /// <summary>
    /// Data Access Layer for Tbl_Customer.
    /// </summary>
    public class dbCustomer
    {
        public dbCustomer()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        public bool Insert_Customer (int CustomerID , string
CustomerName )

            SqlConnection dbConnection = new
SqlConnection("server=<DatabaseServer>;uid=<userid>;pwd=<password>;database<databaseName>");
            SqlCommand Cmd = new
SqlCommand("sp_Insert_Customer", dbConnection);
            Cmd.CommandType = CommandType.StoredProcedure;

            SqlParameter pCustomerID = new
SqlParameter("@CustomerID", SqlDbType.Int, 4);
            SqlParameter pCustomerName = new
SqlParameter("@CustomerName", SqlDbType.VarChar, 255);

            pCustomerID.Value = CustomerID;
            pCustomerName.Value = CustomerName;

            Cmd.Parameters.Add(pCustomerID);
            Cmd.Parameters.Add(pCustomerName);

            try
            {
                dbConnection.Open();
                Cmd.ExecuteNonQuery();
                dbConnection.Close();
                if (Convert.ToBoolean(pStatus.Value))
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            catch
            {
                return false;
            }
        }

    }
}

//************************ STORED PROCEDURE *******************************

CREATE PROCEDURE
.sp_Insert_Customer(
@CustomerID int ,
@CustomerName varchar(500) = NULL
)
AS

INSERT INTO Tbl_Customer(
CustomerID,
CustomerName
)
VALUES (
@CustomerID,
@CustomerName
)

GO

| ASP.net DOCS = http://www.aspng.com/docs
| [aspngfreeforall] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/aspngfreeforall = JOIN/QUIT
| news://ls.asplists.com = NEWSGROUP

| [aspngvb] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngvb.asp = JOIN/QUIT
Reply to this message...
 
 
System.Convert
System.Data.CommandType
System.Data.SqlClient.SqlCommand
System.Data.SqlClient.SqlConnection
System.Data.SqlClient.SqlParameter
System.Data.SqlDbType
System.DBNull
System.EnterpriseServices.ContextUtil
System.EventArgs
System.String




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification