Click here to Skip to main content
15,909,741 members
Home / Discussions / C#
   

C#

 
QuestionRemotingConfiguration.RegisterWellKnownServiceType Pin
yesu prakash22-Apr-09 1:03
yesu prakash22-Apr-09 1:03 
QuestionNHibernate - where clause include result from a STORED PROC Pin
devvvy22-Apr-09 1:02
devvvy22-Apr-09 1:02 
Questionhow do you keep user info in program? Pin
calendarw21-Apr-09 23:42
calendarw21-Apr-09 23:42 
AnswerRe: how do you keep user info in program? Pin
Mbah Dhaim22-Apr-09 0:02
Mbah Dhaim22-Apr-09 0:02 
GeneralRe: how do you keep user info in program? Pin
jo H22-Apr-09 2:22
jo H22-Apr-09 2:22 
QuestionExecuting Shortcuts in Process using C#. Pin
avinashpp21-Apr-09 23:39
avinashpp21-Apr-09 23:39 
AnswerRe: Executing Shortcuts in Process using C#. Pin
Eddy Vluggen21-Apr-09 23:42
professionalEddy Vluggen21-Apr-09 23:42 
GeneralRe: Executing Shortcuts in Process using C#. Pin
avinashpp22-Apr-09 0:10
avinashpp22-Apr-09 0:10 
GeneralRe: Executing Shortcuts in Process using C#. Pin
Eddy Vluggen22-Apr-09 0:34
professionalEddy Vluggen22-Apr-09 0:34 
AnswerRe: Executing Shortcuts in Process using C#. Pin
Rajesh Anuhya22-Apr-09 0:09
professionalRajesh Anuhya22-Apr-09 0:09 
Question[Message Deleted] Pin
hkjghkj121-Apr-09 23:23
hkjghkj121-Apr-09 23:23 
AnswerRe: Size of column name Pin
Michael Bookatz21-Apr-09 23:28
Michael Bookatz21-Apr-09 23:28 
AnswerRe: Size of column name Pin
Thomas Weller21-Apr-09 23:36
Thomas Weller21-Apr-09 23:36 
AnswerRe: Size of column name Pin
Eddy Vluggen21-Apr-09 23:41
professionalEddy Vluggen21-Apr-09 23:41 
General[Message Deleted] Pin
hkjghkj121-Apr-09 23:50
hkjghkj121-Apr-09 23:50 
GeneralRe: Size of column name Pin
Eddy Vluggen21-Apr-09 23:56
professionalEddy Vluggen21-Apr-09 23:56 
General[Message Deleted] Pin
hkjghkj122-Apr-09 0:02
hkjghkj122-Apr-09 0:02 
GeneralRe: Size of column name Pin
Henry Minute22-Apr-09 0:11
Henry Minute22-Apr-09 0:11 
General[Message Deleted] Pin
hkjghkj122-Apr-09 0:26
hkjghkj122-Apr-09 0:26 
GeneralRe: Size of column name Pin
Skymir23-Apr-09 3:23
Skymir23-Apr-09 3:23 
QuestionMy Ado.Net code is on a Public Holiday Pin
Vimalsoft(Pty) Ltd21-Apr-09 23:20
professionalVimalsoft(Pty) Ltd21-Apr-09 23:20 
Good Afternoon All

As you know in South Africa today is a Election day, i think my ado.net code went to the Elections tooo

i have this code in my DAL

public DataSet Lis_Databases(String DB)
        {

            Strcon = GetConnectionString(DB);


            con = new SqlConnection(Strcon);

            cmdselect = new SqlCommand();

            cmdselect.CommandText = "[dbo].[sp_ListDatabasesOfType_Booking]";

            cmdselect.CommandType = CommandType.StoredProcedure;

            cmdselect.Connection = con;

            da = new SqlDataAdapter();

            da.SelectCommand = cmdselect;

            DataSet ds = new DataSet();

            try
            {
                con.Open();

                da.Fill(ds);
            }
            catch (SqlException)
            {
                throw;
            }
            finally
            {
                if (con != null)
                {
                    con.Close();
                }
            }

            return ds;

        }


and i call this code in my BLL like this

public DataSet Lis_Databases(String DB)
        {
            DAL.DAL obj = new DAL.DAL();

            DataSet ds = new DataSet();

            try
            {
                ds = obj.Lis_Databases(DB);
            }
            catch (SqlException)
            {   
                throw;
            }
            finally
            {

                obj = null;
            }
            return ds;
           
        }


And call use it like this in my PL(Presention Layer)

private void List_Databases_Grid()
    {
        
            BLL.BLL obj = new BLL.BLL();
        
            DataSet ds = new DataSet();

        try
        {

            ds = obj.Lis_Databases(Convert.ToString(Session["ActiveDatabase"]));

            if (ds.Tables[0].Rows.Count > 0)
            {
                GridView_Database_list.DataSource = ds;

                GridView_Database_list.DataBind();
            }
            else
            {
                lblMessage.Text = "No Booking Database Avaiable,Create one";
                lblMessage.Visible = true;
                lblMessage.ForeColor = System.Drawing.Color.Red;
            }
        }
        catch (SqlException ex)
        {
            lblMessage.Visible = true;
            lblMessage.Text = "The List cannot be Binded, Please Contact ITS" + ex.Message;
            lblMessage.ForeColor = System.Drawing.Color.Red;
        }
        finally
        {
            obj = null;
        }

    }


when my code Comes to this line
if (ds.Tables[0].Rows.Count > 0)
           {


The evualuation, it passes and that mean records had been returned, now when it gets to this line

GridView_Database_list.DataSource = ds;


it says

Object reference not set to an instance of an object.

i have Initialized the Dataset everywhere as you can see above

what have i done wrong?

You can still Comment on my Error handling

Thank you

Vuyiswa Maseko

Vuyiswa Maseko,

Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."

C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/

AnswerRe: My Ado.Net code is on a Public Holiday Pin
Mbah Dhaim21-Apr-09 23:31
Mbah Dhaim21-Apr-09 23:31 
GeneralRe: My Ado.Net code is on a Public Holiday Pin
Vimalsoft(Pty) Ltd21-Apr-09 23:36
professionalVimalsoft(Pty) Ltd21-Apr-09 23:36 
GeneralRe: My Ado.Net code is on a Public Holiday Pin
Greg Chelstowski21-Apr-09 23:46
Greg Chelstowski21-Apr-09 23:46 
GeneralRe: My Ado.Net code is on a Public Holiday Pin
Vimalsoft(Pty) Ltd22-Apr-09 0:00
professionalVimalsoft(Pty) Ltd22-Apr-09 0:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.