PC Review


Reply
Thread Tools Rate Thread

custom database insert method - how to use it with popups?

 
 
Andy B
Guest
Posts: n/a
 
      1st Jan 2008
I have the following method in C#:

public bool AddNews(DateTime Date, String subjectm, String Body) {

NewsDataSet.NewsArticlesDataTable NewsArticles = new
NewsDataSet.NewsArticlesDataTable();

NewsDataSet.NewsArticlesRow NewsArticle = NewsArticles.NewNewsArticlesRow();

NewsArticle.Date=Date;

NewsArticle.Text=Body;

NewsArticle.Title=subjectm;

NewsArticles.AddNewsArticlesRow(NewsArticle);

int RowsAffected = NewsArticlesAdapter.Update(NewsArticles);

return RowsAffected==1;

}


What I want to do, is if the method fails, display a user friendly error in
a popup dialog and if the method was successful, show a message that it
worked. How would you do this? I am trying to put it in the
FinishButton_Click event of a Wizard control.



 
Reply With Quote
 
 
 
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      1st Jan 2008
"Andy B" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> How would you do this?


if (AddNews(...parameters go here...))
{
ClientScript.RegisterStartupScript(GetType(), "AddNews",
"alert('Success');", true);
}
else
{
ClientScript.RegisterStartupScript(GetType(), "AddNews",
"alert('Failure');", true);
}

Modify the alerts as required...


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

 
Reply With Quote
 
Andy B
Guest
Posts: n/a
 
      1st Jan 2008
Got it! Now one more question... What is the "AddNews" in the register
script thing for?

"Mark Rae [MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "Andy B" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>
>> How would you do this?

>
> if (AddNews(...parameters go here...))
> {
> ClientScript.RegisterStartupScript(GetType(), "AddNews",
> "alert('Success');", true);
> }
> else
> {
> ClientScript.RegisterStartupScript(GetType(), "AddNews",
> "alert('Failure');", true);
> }
>
> Modify the alerts as required...
>
>
> --
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net



 
Reply With Quote
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      1st Jan 2008
"Andy B" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> Got it! Now one more question... What is the "AddNews" in the register
> script thing for?


http://msdn2.microsoft.com/en-us/library/z9h4dk8y.aspx


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

 
Reply With Quote
 
 
 
Reply

Thread Tools
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
insert row method (?) mark kubicki Microsoft Excel Programming 4 26th May 2006 06:40 PM
Insert method problems Ed Dror Microsoft ASP .NET 1 1st Feb 2006 12:27 AM
Insert record into Excel database using a custom VBA form? dspame@yahoo.com Microsoft Excel Programming 3 31st Jul 2005 03:54 AM
Custom attribute for a method: how to get the method object ? Oriane Microsoft Dot NET 1 12th Jun 2005 09:47 PM
Any method available to insert pic into comment box?? C Microsoft Excel Misc 1 15th Jan 2005 12:30 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:57 AM.