Hi,

Im trying to retrieve some particular datas from SQL column into RichTextBox in WindowsForm. Im Getting only whole SQL column from SQL Table. If u know the answer, Kindly post.

Thanks in advance

If you are looking only for certain/particular data and getting the whole column of data you would have to refine your SQL Statement or get all of the data and use your C# to parse through and parse out what you want.

"SELECT (particularField1,particularField2) FROM database1 WHERE 'certain criteria';"

Ok so then what is the issue? That is particular data that you are getting? Do you have a list of what you are getting and what you want to get? When you query it will return all of the data you ask for.

Hi....

I think im not having problem in my SQL statements but in c# code... I have 3 tables in my database and im having sevral columns in it. I just want to retrieve the datas into my richtextBox from the column called 'Code type' which is present in two of my tables.

My RichTextBox Should be like this

SELECT Heading, Rating, Code type, Details FROM TableMovies WHERE (Rating = 'x' ) AND (CategoryCode = y )

But im Getting it as

SELECT Heading, Rating, Code type, Details FROM TableMovies WHERE (Rating = 'x' ) AND (CategoryCode = )

Here is my c# Coding:

MyRichTextBoxName.Text = "SELECT Heading, Rating, Code type, Details FROM TableMovies WHERE (Rating = '" + this.MyCheckedlistBoxName.Text + "' ) AND (CategoryCode =";

I need the c# coding for my CodeType

It's a simple logic, but i don't know how to do. If i get the answer for it, my project will be finish.

Thanks all in advance

Of course you are going to get many columns. Anything that is between the SELECT and FROM are the columns that you are going to return.

This article has been dead for over six months. Start a new discussion instead.