could brothers and sisters welcome me by looking into this longlasted problem:

"INSERT  INTO finaldata (Hall, Bedspace, AmountPaid) SELECT * FROM AllcDataBoys 'WHERE Bedspace ='" + (Bespx.CompareTo(RET) == 0) + "'WHERE RegNumber ='" + txtRegNumber.Text.Trim().ToString();

finaldata table has 7 columns and AllcDataBoys table has 3 columns(which is common on both tables).
i want to get a specified row from AllcDataBoys where (Bespx.CompareTo(RET)==0)and put them in finaldata where txtRegNumber match any RegNumber data where the 3 columns exit among the 7 column in finaldata table. -- the error it gives: incorrect syntax!

Bespx is AllcDataBoys table data.
RET is argument passedto the method container.

"INSERT  INTO finaldata (Hall, Bedspace, AmountPaid) SELECT * FROM AllcDataBoys WHERE Bedspace ='" + (Bespx.CompareTo(RET) == 0) + "' AND  RegNumber ='" + txtRegNumber.Text.Trim().ToString()+"'";

Hope this helps :)

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.