954,517 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

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.

Tellie
Newbie Poster
11 posts since Apr 2004
Reputation Points: 7
Solved Threads: 0
 

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).

Tekmaven
Software Architect
Moderator
1,274 posts since Feb 2002
Reputation Points: 322
Solved Threads: 28
 

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.net-dataproviders/ado.net-executescalar-sqlcommand.htm

bruce

bruce2424
Newbie Poster
23 posts since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You