Top DevX Stories
Creating Custom Export Filters for StarOffice with XSLT
WPF Wonders: Using DataTemplates
Crystal Reports Family Offers Options for Developers
Avaya Aura Session Manager video
Avaya Aura Overview video
Search the forums:

Go Back   DevX.com Forums > DevX Developer Forums > .NET

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 10-30-2009, 05:49 AM
Lennie Lennie is offline
Registered User
 
Join Date: Jan 2005
Location: New Zealand
Posts: 201
C#Net 2003 - TRY/CATCH MessageBox.show not working

Hi Everyone.
I need your help. I am using C#.NET 2003 to create this block of script:-

try
{
SqlConnection sqlConn = new SqlConnection(connStr);
SqlCommand sqlCmd = New SqlCommand;
SqlCmd.Connection = sqlConn;
sqlCmd.CommandType = CommandType.Text;
sqlCmd.CommandText = "Select * From TblCustomer";
sqlCmd.Connection.Open();
int intCnt = sqlCmd.ExecuteNonQuery();
}

catch (Exception ex)
{
MessageBox.Show(ex.Message);
}

finally
{
sqlCMD.Connection.CLOSE();
}
--------------------------------------------------------------
This error message listed below was generated on script compilation:-
"The type or namespace name 'MessageBox' could not be found (are you missing a using directive or an assembly reference?)"
__________________
Cheers,
Lennie
Reply With Quote
  #2  
Old 10-30-2009, 08:41 AM
Hack's Avatar
Hack Hack is offline
Super Moderator
 
Join Date: Apr 2007
Location: Sterling Heights, Michigan
Posts: 7,719
Moved From C++ to .NET section
__________________
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
Please use [Code]your code goes in here[/Code] tags when posting code.
Before posting your question, did you look here?
Got a question on Linux? Visit our Linux sister site.
Modifications Required For VB6 Apps To Work On Vista

Microsoft MVP 2005/2006/2007/2008/2009
Reply With Quote
  #3  
Old 10-30-2009, 03:45 PM
csillagyitzik's Avatar
csillagyitzik csillagyitzik is offline
Registered User
 
Join Date: Feb 2007
Posts: 9
Windows.Forms namespace

The MessageBox is only availible from Windows.Forms namespace.
Reply With Quote
  #4  
Old 10-30-2009, 06:12 PM
Lennie Lennie is offline
Registered User
 
Join Date: Jan 2005
Location: New Zealand
Posts: 201
Hi Csillagyitzik and Hack,

Yee...Haaa.......my script is working now based on your suggestion.

Thank you very very much for sharing your knowledge with me. As a newbie to C#Net 2003 with the information from both of you makes my life easy. Thanks to both of you. Both of you are awesome and generous with information.

Have a good Day.
__________________
Cheers,
Lennie
Reply With Quote
  #5  
Old 11-02-2009, 08:59 AM
Hack's Avatar
Hack Hack is offline
Super Moderator
 
Join Date: Apr 2007
Location: Sterling Heights, Michigan
Posts: 7,719
I know I've said it before Lennie, but you really should upgrade from 2003.
__________________
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
Please use [Code]your code goes in here[/Code] tags when posting code.
Before posting your question, did you look here?
Got a question on Linux? Visit our Linux sister site.
Modifications Required For VB6 Apps To Work On Vista

Microsoft MVP 2005/2006/2007/2008/2009
Reply With Quote
  #6  
Old 11-02-2009, 10:34 PM
Lennie Lennie is offline
Registered User
 
Join Date: Jan 2005
Location: New Zealand
Posts: 201
Hi Hack,
Would love to upgrade Net 2003 but the company that I am working for, is reluctant to the upgrade.

I have another problem which I have submitted it's about adding CheckBox in DataGrid for all the Rows. Please help me, Hack.

Thanks ,
__________________
Cheers,
Lennie
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
UPDATE SQL Not working under VB.Net 2003 Lennie .NET 2 06-17-2009 05:52 AM
error in deploying outlook 2003 addin (in client`s system) pranava .NET 0 03-12-2009 06:03 AM
ACCESS 2003 SQL LIKE Operator not working in VB6 runtime Lennie VB Classic 4 05-29-2008 06:39 PM
TierDeveloper Full-Integration with Microsoft Visual Studio .NET 2003 IDE Zahid Iqbal dotnet.announcements 0 05-20-2003 08:06 AM


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


Sponsored Links



Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.