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

  • SEARCH
  • Home
  • 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 8714613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:38:25+00:00 2026-06-13T05:38:25+00:00

I am writing web service method to retrieve the data of the user. To

  • 0

I am writing web service method to retrieve the data of the user. To make clear, I have a table called User in my database, which has, ID, fName, lName, emailAddress, username, password, reg_ID. If i used the ID to retrieve the data, it will work but instead if i use emailAddress in “where” clause, it gives me following error.

Web service method

 [WebMethod(Description = "Returns Details of User with username")]
        public DataSet GetUser(string user)
        {
            DataSet dataSet = new DataSet();
            OleDbConnection oleConn = new OleDbConnection(connString);

            try
            {
                oleConn.Open();
                string sql = "SELECT * FROM [User] WHERE [username]=" + user;
                OleDbDataAdapter dataAdapter = new OleDbDataAdapter(sql, oleConn);
                dataAdapter.Fill(dataSet, "User");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            finally
            {
                oleConn.Close();
            }
            if (dataSet.Tables["User"].Rows.Count <= 0)
                return null;

                return dataSet;
        }

Error

System.NullReferenceException: Object reference not set to an instance of an object.
   at UserManagement.UserRegistration.GetUser(String user) in C:\Users\smartamrit\Desktop\SystemSoftware\UserManagement\UserRegistration.asmx.cs:line 170

Line 170 starts at
if (dataSet.Tables["User"].Rows.Count <= 0)

  • 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-06-13T05:38:28+00:00Added an answer on June 13, 2026 at 5:38 am

    Did you use single quotes while passing the email id or try to use like statement when passing email id. Have you check whether any exception raises in the catch block.

    The possible reason is there may occur a exception in catch block, it was suppressed and after that the if statement has executed and throwed a error that user table was not found.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a Web Service to retrieve Invoice information from a database table.
I'm writing a web service which expects one of the parameters (called hlink) to
I am writing a web service which has to be able to reply to
I'm writing a web service which, for each method call, must write a log
Im writing an iPhone app which retrieves data from a web service as XML.
I have a soap web service that is connected to mySQL database. It has
I am writing a web service using WCF. I created data contracts. I created
I'm writing a simple Google Web Toolkit service which acts as a proxy, which
I am writing a tool to integrate with a web service, I have a
I'm writing a web service which is wrapper for a vendor's web service, and

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.