Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 3rd, 2004, 02:14 AM
Authorized User
 
Join Date: Jul 2004
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Default query related problem

I want that when i execute a select query,then the no of rews affected
by the query are to be known.
I've wrote the following code

Dim ret as integer
cmdSelect = New SqlCommand("Select Tech_Name From Technology where Tech_Name='" & Tech_Txt.Text & "' ", con)
ret = cmdSelect.ExecuteNonQuery

If (ret = 0) Then
'some operation
else
'some...
end if

but it not working,is it right way doing this.
whats the sol'n.

abhinavjain
__________________
abhinavjain
 
Old September 3rd, 2004, 09:23 PM
Friend of Wrox
 
Join Date: Aug 2003
Posts: 108
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to life_s Ng Send a message via MSN to life_s Ng
Default

whats the error u get?

try to use executeQuery insteed of executenonQuery. executeNonQuery is for insert, update and delete.

hope this help
life's Ng

 
Old September 6th, 2004, 02:46 AM
Authorized User
 
Join Date: Feb 2004
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to mahulda
Default

If nothing works then try out this

Dim ret as integer = 0
Dim myreader

cmdSelect = New SqlCommand("Select ....., con)
myreader = cmdSelect.ExecuteReader
While myreader.read()
     ret += 1
End While

myreader.close()
con.close()

If (ret = 0) Then
'some operation
else
'some...
end if


-.. -..





Similar Threads
Thread Thread Starter Forum Replies Last Post
another tcp/ip related query watashi C# 2005 0 August 30th, 2007 07:31 PM
database related query dkvaseeta Pro VB Databases 2 February 22nd, 2007 10:59 AM
Repeater Control Related Query param99 ASP.NET 1.0 and 1.1 Professional 1 December 14th, 2006 04:17 AM
query related to function nimeshkumargupta SQL Server 2000 0 January 18th, 2005 04:05 AM
problems with related query apek PHP How-To 5 February 4th, 2004 02:06 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.