Thursday, 15 March 2012

database - getting data from rows after executing query -


I am very new to DB application development, although I have VB.NET and C ++ (self-taught, somewhat intermediate). I have a query in a table adapter with two parameters (user input), which always gives a line from a table based on those two parameters. Suppose line X filters with A, B and C columns are set to A and B in my query, but it selects all the fields. Now, I want to show the value of C in one of my main form objects (the label says in this example), but I can not be able to remove it. I know that maybe this is very easy, but I've lost some of the DB codes in the forest.

[edit]

My apologies, code bit (example).

query:

SELECT Column1, Column2, Column3
Table1
WHERE (column1 = parameter1) AND (Column2 = @ Parameter2)

VB project in me:

Slow Temporary
Temporary = Me.Table1TableAdapter.queryName (Me.MyProjectDBDataSet.Table1, userinput1, userinput2)

Everything until this point Works perfectly, but this is also where I get stuck. How do I, let's say that the value of column 3 is specified, for example, the label.Text (the result will always be just one line from Table1 after running the query)?

I hope this clears it a little bit ..

  dim database database = DatabaseFactory.CreateDatabase in as dim cmd DbCommand = db.GetSqlStringCommand (query) dim SqlDataReader as IDataReader = db.ExecuteReader (cmd) through the rows of new MyObject then SqlDataReader 'DataReader as dim myObj the loop then isnot nothing ( 'query is a string containing your SQL command while sqlDataReader.Read)' column with the value 3 here 'myObj.myIntegerProp erty = CInt (IIf (Aisdianblul (Atom ( "Column 3")), 0, Atom ( "Column 3")) loop and if  

No comments:

Post a Comment