c# verifying Login Info from 2 different tables in Database

Posted on 2011-04-22
Medium Priority
Last Modified: 2012-05-11
i have 2 tables   in access

1) Customer  - lastname,firstname.
2)Login - UserID , Pin .

im trying to verify the username and pin from login table , then return the lastname and first name from the customer table.  

i keep getting this error " No value given for one or more required parameters."

public  static string LognCus(string a, string b)
          string UsNamess = a;
          string PassWd = b;

          OleDbCommand cmd = DbUtils.GetCommand();
          cmd.CommandType = CommandType.Text;
          cmd.CommandText = "Select Login.UserID,Login.Pin,Cusomter.LastName,Customer.FirstName FROM [Login] INNER JOIN [Customer] ON Login.[ID]=Customer.[ID]  WHERE Login.UserID='" + UsNamess + "' AND Login.Pin='" +(Convert.ToInt32( PassWd)) + "'";

          OleDbDataReader rdr = null;
          rdr = cmd.ExecuteReader();

          string usname = string.Empty;

          if (rdr.Read() == true)
              usname = rdr["Customer.FirstName"].ToString() + " " + rdr["Customer.LastName"].ToString();


          return usname;

Open in new window

Question by:Ajs135

Accepted Solution

edemcs earned 1200 total points
ID: 35451385
You have a typo.  In your select statement, change Cusomter.LastName to Customer.LastName
LVL 21

Assisted Solution

by:Alpesh Patel
Alpesh Patel earned 800 total points
ID: 35451808
Missing parameter to pass in Query.

After assignment Please check value of  cmd.CommandText. It will give you better answer.

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question