Dear Friends,

Here I have tried to connect to Sybase Adaptive Server Anywhere 7.0 with the following code in C# as console application,
I am getting the ERROR: System.NullReference Exception occured in , this code executed after running the asademo.

Can you help me out where exactly I am going wrong!!!!!!

using System;
using System.Data;
using System.Data.OleDb;

namespace SybaseConnect
    /// <summary>
    /// Summary description for Class1.
    /// </summary>
    class Class1
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(string[] args)
            // TODO: Add code to start application here
            OleDbConnection myConnection =  new OleDbConnection(
            //open the connection
            //Creating command object.
            OleDbCommand myCommand = myConnection.CreateCommand();
            //Specify query
            myCommand.CommandText = "Select fname, lname from Customer";
            //DataReader for the command
            OleDbDataReader myDataReader = myCommand.ExecuteReader();
            //Let's display data
            while ( myDataReader.Read())


================================================ :)

Is it me, or are you not specifing a server in your connection string?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.