Hi. im developing a loan processing system using mvc c# asp.net.
One of the requirements of the system is to perform a credit history check on the customer applying for a loan.

so this is how it works:
-the customer applies for a loan. the customers id number gets stored in the id document table in the database.
-since we can't automate the credit history heck process, the information is sent to an excl file so the employee then enters the customer's ID number in the system they have to do the necessary check.
-so the employee clicks on the option "credit check" which will populate a view with all the customer's whose credit check status is "Pending".

in my business logic i have the following method to transfer the data into an excel file

    public DataTable GetForCreditCheck()
        using (var conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString))
        using (var cmd = new SqlCommand("SELECT * FROM IdentityDocuments", conn))
        using (var adapter = new SqlDataAdapter(cmd))
            var idDocuments = new DataTable();
            return idDocuments;

look at "using (var cmd = new SqlCommand("SELECT * FROM IdentityDocuments", conn))".
Instead of saying "SELECT * FROM IdentityDocuments" i just want to select the ID number field ... what's the sql syntax for that?

3 Years
Discussion Span
Last Post by Amr.Mohammad87

and what if i want to submit more than 1 field, eg customer name, surname, and id number?

SELECT Column1, Column2, Column3...
From     [table name goes here]
WHERE [condition goes here for filtering result "if wished"]

Try not to use SELECT * FROM [table name] as it is not a performance wise. Try to specifiy the columns as possible as you can. The execution steps followed by the db engine is as follows:
1- FROM [table]
2- WHERE [condition]
3- GROUP BY [group]
4- HAVING [condition on grouping basis]
5- SELECT [columns]
6 ORDER BY [columns to order result by] [ASC|DESC]

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.