Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5955317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:05:49+00:00 2026-05-22T18:05:49+00:00

I have first manually created a DataSet in my project name recvd.xsd having corresponding

  • 0

I have first manually created a DataSet in my project name recvd.xsd having corresponding recvd.xss. On my button click event i have done the following coding.

try 
{
    DataSet recvd_REPORT = new DataSet();
    DataTable REPORT = new DataTable();
    String dd_webCofig = ConfigurationManager.ConnectionStrings["server2"].ConnectionString;
    OdbcConnection ddlistconn = new OdbcConnection(dd_webCofig);
    ddlistconn.Open();

    REPORT = recvd_REPORT.Tables["REPORT"];
    DataColumn myDataColumn = new DataColumn();
    myDataColumn.DataType = typeof(System.Int32);
    myDataColumn.ColumnName = "RECEIVED";
    myDataColumn.ReadOnly = false;
    myDataColumn.Unique = false;
    // Add the Column to the DataColumnCollection.
    REPORT.Columns.Add(myDataColumn);

    string query = "SELECT case_no as \"RECEIVED\" from dcpanaji.Civil_t where dt_regis > '" + txtStartDate.Text + "' AND dt_regis < '" + txtEndDate.Text + "' AND court_no = " + DropDownList1.SelectedItem + "";
    Response.Write(query);
    OdbcCommand cmd = new OdbcCommand(query, ddlistconn);
    OdbcDataReader loginMyReader = cmd.ExecuteReader();

    OdbcDataAdapter adptr = new OdbcDataAdapter(query, ddlistconn);
    adptr.Fill(REPORT);

    ddlistconn.Close();   
}
catch (Exception ex)
{
    Response.Write(ex.Message);
}

I am getting the error as

Object reference not set to an instance of an object.

If i remove as \"RECEIVED\" from my SQL query and simply execute my SQL query than the result of my query is as follows (varies depending on user input)

200200000452011 ……, n numbers of 12 digit number.

Please help me to remove the error as to why am i not able to bind to DataTable.

I am getting the error before Response.Write(query); is executed, why is that problem?

I removed the try catch block and now i get the error as

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T18:05:50+00:00Added an answer on May 22, 2026 at 6:05 pm

    try

    SELECT case_no as `RECEIVED` ...
    

    or just

    SELECT case_no as RECEIVED ...
    

    Anyway the correct DataSet filling code should look like this:

    DataSet ds = new DataSet();
    using (OdbcConnection connection = new OdbcConnection(connectionString))
    using (OdbcCommand command = new OdbcCommand(sqlQuery, connection)
    using (OdbcDataAdapter adapter = new OdbcDataAdapter(command)
    {
        adapter.Fill(ds);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have three views that I've manually created in the DB. First view is
I have a Web Application that I received from another developer, when I first
I've created a custom validator for my project, it simply checks the select ones
I've created solution to reproduce a problem that I'm having with MVVM-Light EventToCommand vs
If a DataSet contains a column that is a timestamp or other binary value,
I have been working offline for a couple of days so I didn't have
I have deployed an application that uses EF to the same server as my
I have been trying to figure out why my AnimationListener events are not being
I have a problem with the custom eval functions when the record is called
I've just started using Jenkins today, so it's entirely possible that I've missed something

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.