Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 3rd, 2004, 02:14 AM
Authorized User
 
Join Date: Jul 2004
Location: Delhi, Delhi, India.
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
Reply With Quote
  #2 (permalink)  
Old September 3rd, 2004, 09:23 PM
Friend of Wrox
 
Join Date: Aug 2003
Location: , , .
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

Reply With Quote
  #3 (permalink)  
Old September 6th, 2004, 02:46 AM
Authorized User
 
Join Date: Feb 2004
Location: Delhi, Delhi, India.
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


-.. -..
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 06:06 PM.


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