DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   VB.NET (http://www.daniweb.com/forums/forum58.html)
-   -   Sql Query (http://www.daniweb.com/forums/thread5593.html)

Tellie Apr 28th, 2004 10:58 am
Sql Query
 
Hi All

I have a select statement:

Select PERMISSION_BUTTON_ID from ALC_SECURITY_PERMISSION where ROLE_ID = 1

Now I want to store / retrieve the values of the field that I am querying without using dataset. Is this possible? If yes how can I do this?

Is it possible that I declare a variable Array and store the output.

Tekmaven Apr 29th, 2004 7:52 am
Re: Sql Query
 
Well, if it's only one value that your going to be returned, you can use the .ExecuteScalar, which returns an Object (the first row, first column of your query).

bruce2424 Nov 12th, 2008 4:45 am
Re: Sql Query
 
You can retrieve data from database without using dataset .

cnn.Open()
cmd = New SqlCommand(sql, cnn)
Dim count As Int32 = Convert.ToInt32(cmd.ExecuteScalar())
cmd.Dispose()
cnn.Close()

http://vb.net-informations.com/ado.n...sqlcommand.htm

bruce


All times are GMT -4. The time now is 9:01 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC