How can i do if query return no matching row??

talukdarmanoj

Member
Joined
Sep 26, 2007
Messages
6
Programming Experience
Beginner
myAccAdaptor = New MySql.Data.MySqlClient.MySqlDataAdapter
myComm = New MySql.Data.MySqlClient.MySqlCommand("Select * from Purchase where PartName='MotherBoard'")
myComm.Connection = myCnn
myAccAdaptor.SelectCommand = myComm

if this sql query return no matching row then I want to display a message box. How can i do this ?
I m using VB2005
 
Youre also using MySQL, you poor thing. If ther is any option to switch to SQLServer or ORACLE, take it; they both ahve free versions

To check if there is any output from that query, simply fill a datatable with it, and then see how many rows the datatable has..

dt.Rows.Count = 0 'no data returned
 
Back
Top