Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > .NET Web Services
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
.NET Web Services Discussions about .NET XML Web Service technologies including ASMX files, WSDL and SOAP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Web Services 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 November 26th, 2003, 10:11 AM
Authorized User
 
Join Date: Nov 2003
Location: Ha Noi, , Vietnam.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default Execute method of web service, about database?

Hi all

I create s web service, it have a method updateDemo. The method use to update data of dataset.
When it is runed only one row executes successfully. However I added new or modifyed records

But also method here, when it is runed at side client then ok. I don't the reason why. I hope you help. Thank you very much!

Reply With Quote
  #2 (permalink)  
Old December 2nd, 2003, 10:29 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

What is the method doing?
What does the method accept as argument(s)?

Peter
------------------------------------------------------
Work smarter, not harder.
Reply With Quote
  #3 (permalink)  
Old December 3rd, 2003, 03:13 AM
Authorized User
 
Join Date: Nov 2003
Location: Ha Noi, , Vietnam.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

        public static bool UpdateTable(string strTableName, DataSet ds)
        {
            //
            if(ds == null)
                return false;
            //
            if(ds.GetChanges() == null)
                return true;
            //
            OleDbConnection pConn = OleDbConnection (strCon) ;
            pConn.Open();
            if(pConn != null && pConn.State == ConnectionState.Open)//
            {
                OleDbTransaction dbTrans = null;
                string mySelectQuery = "SELECT * FROM " + strTableName;
                try
                {

                    dbTrans = pConn.BeginTransaction(IsolationLevel.ReadCommitte d);
                    OleDbDataAdapter myDataAdapter = new OleDbDataAdapter();
                    //
                    myDataAdapter.RowUpdating += new OleDbRowUpdatingEventHandler(OnRowUpdating);
                    myDataAdapter.RowUpdated += new OleDbRowUpdatedEventHandler(OnRowUpdated);

                    myDataAdapter.SelectCommand = new OleDbCommand(mySelectQuery, pConn, dbTrans);
                    OleDbCommandBuilder myCommandBuilder = new OleDbCommandBuilder(myDataAdapter);
                    //
                    int k = myDataAdapter.Update(ds,strTableName);
                    //
                    if((dbTrans != null) && (dbTrans.Connection != null))
                        dbTrans.Commit();
                    if(myCommandBuilder != null)
                        myCommandBuilder.Dispose();
                    if(myDataAdapter != null)
                        myDataAdapter.Dispose();
                    //
                    foreach(DataRow dr in ds.Tables[strTableName].Rows)
                    {
                        if(dr.HasErrors)
                            continue;
                        else
                            dr.AcceptChanges();
                    }
                    DisConnectDB(pConn);//Function disconnect
                    return true;
                }
                catch(Exception myException)
                {
                    if((dbTrans != null) && (dbTrans.Connection != null))
                        dbTrans.Rollback();
                    MsgError = myException.Message.ToString();//return a message error
                    DisConnectDB(pConn);//Function disconnect
                    return false;
                }
            }
            return false;
        }
Reply With Quote
  #4 (permalink)  
Old December 3rd, 2003, 03:18 AM
Authorized User
 
Join Date: Nov 2003
Location: Ha Noi, , Vietnam.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Calling from service:
        [WebMethod]
        public bool updateDemo(DataSet ds, string strTableName)//
        {
            //DataSet
            bool b = clsData.UpdateTable(strTableName,ds);
            return b;
        }

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
Execute Scalar method bmains ADO.NET 2 October 11th, 2008 11:41 PM
c# web service execute remote command? chintu926 .NET Web Services 1 May 24th, 2006 07:05 AM
Hoe Can I Execute an exe file in my web service? ROnak Classic ASP Basics 1 September 14th, 2004 12:09 AM
About method of class in Web Service hueduongit .NET Web Services 5 December 11th, 2003 09:09 PM
Object as parameter in a web service method evandro.paula .NET Web Services 3 October 14th, 2003 02:20 PM



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


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