use sqlxml access database

Discussion in 'ASP .Net Web Services' started by goodmannewz, May 10, 2005.

  1. goodmannewz

    goodmannewz Guest

    Could u please tell me why the following codes cannot run in webservice while
    these codes can be run in a window form? Thanks.
    [WebMethod]
    public string test()
    {
    DataRow tempRow;
    SqlXmlAdapter ad;
    MemoryStream ms=new MemoryStream();
    SqlXmlCommand cmd=new SqlXmlCommand("Provider=SQLOLEDB;data
    source=\"127.0.0.1\";initial catalog=Northwind;user id=\"test\";
    password=\"test\"");
    cmd.RootTag="ROOT";
    cmd.CommandText="Emp";
    cmd.CommandType=SqlXmlCommandType.XPath;
    cmd.SchemaPath="..\\XMLSchema1.xsd";
    DataSet ds = new DataSet();
    ad=new SqlXmlAdapter(cmd);
    ad.Fill(ds);
    tempRow=ds.Tables["Emp"].Rows[0];
    tempRow["FName"] = "Susan";
    ad.Update(ds);
    return "ok";
    }
    the codes in windows form:
    private void button2_Click(object sender, System.EventArgs e)
    {
    DataRow row;
    SqlXmlAdapter ad;
    MemoryStream ms = new MemoryStream();
    SqlXmlCommand cmd=new SqlXmlCommand("Provider=SQLOLEDB;data
    source=\"127.0.0.1\";initial catalog=Northwind;user id=\"test\";
    password=\"test\"");
    cmd.RootTag = "ROOT";
    cmd.CommandText = "Emp";
    cmd.CommandType = SqlXmlCommandType.XPath;
    cmd.SchemaPath = "..\\XMLSchema1.xsd";
    DataSet ds = new DataSet();
    ad = new SqlXmlAdapter(cmd);
    ad.Fill(ds);
    row = ds.Tables["Emp"].Rows[0];
    row["FName"] = "Susan";
    ad.Update(ds);
    textBox1.Text="It is ok.";
    }
    goodmannewz, May 10, 2005
    #1
    1. Advertising

  2. "=?Utf-8?B?Z29vZG1hbm5ld3o=?=" <>
    wrote in news::
    > Could u please tell me why the following codes cannot run in webservice
    > while these codes can be run in a window form? Thanks.


    It might be helpful if you defined what "cannot run" means.


    --
    Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
    "Programming is an art form that fights back"

    Blog: http://blogs.atozed.com/kudzu
    Chad Z. Hower aka Kudzu, May 10, 2005
    #2
    1. Advertising

  3. goodmannewz

    goodmannewz Guest

    Thank you for your attention.

    The following is the error messge from IE:
    "HTTP 500 - Internal server error " after I invoked.
    And I went through step by step debugging, the same error message was shown,
    no further information.

    Thanks

    "Chad Z. Hower aka Kudzu" wrote:

    > "=?Utf-8?B?Z29vZG1hbm5ld3o=?=" <>
    > wrote in news::
    > > Could u please tell me why the following codes cannot run in webservice
    > > while these codes can be run in a window form? Thanks.

    >
    > It might be helpful if you defined what "cannot run" means.
    >
    >
    > --
    > Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
    > "Programming is an art form that fights back"
    >
    > Blog: http://blogs.atozed.com/kudzu
    >
    goodmannewz, May 10, 2005
    #3
  4. "=?Utf-8?B?Z29vZG1hbm5ld3o=?=" <>
    wrote in news::
    > Thank you for your attention.
    >
    > The following is the error messge from IE:
    > "HTTP 500 - Internal server error " after I invoked.
    > And I went through step by step debugging, the same error message was
    > shown, no further information.


    Turn off friendly errors in IE, then try again to see what the real error is.


    --
    Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
    "Programming is an art form that fights back"

    Blog: http://blogs.atozed.com/kudzu
    Chad Z. Hower aka Kudzu, May 11, 2005
    #4
  5. goodmannewz

    goodmannewz Guest

    Dear Chad,

    Thank you very much for your reply.

    I tried the same code on another machine. And I tried many way to specify a
    path("../XMLSchema1.xsd" or "D:/Inetpub/wwwroot/WebService1/XMLSchema1.xsd"
    or @"D:\Inetpub\wwwroot\WebService1\XMLSchema1.xsd") however all failed. The
    error was the following:
    Microsoft.Data.SqlXml.SqlXmlException: Schema: Cannot find the specified
    schema file 'XMLSchema1.xsd'. --->
    System.Runtime.InteropServices.COMException (0x800C0006): Schema: Cannot find
    the specified schema file 'XMLSchema1.xsd'.
    at
    Microsoft.Data.SqlXml.Common.ISQLXMLCommandManagedInterface.ExecuteToOutputStream()
    at Microsoft.Data.SqlXml.SqlXmlCommand.innerExecute(Stream strm)
    --- End of inner exception stack trace ---
    at Microsoft.Data.SqlXml.SqlXmlCommand.ExecuteStream()
    at Microsoft.Data.SqlXml.SqlXmlCommand.ExecuteXmlReader()
    at Microsoft.Data.SqlXml.SqlXmlAdapter.Fill(DataSet ds)
    at WebService1.Service1.test() in
    d:\inetpub\wwwroot\webservice1\service1.asmx.cs:line 76

    Thanks again.

    Ryan


    "Chad Z. Hower aka Kudzu" wrote:

    > "=?Utf-8?B?Z29vZG1hbm5ld3o=?=" <>
    > wrote in news::
    > > Thank you for your attention.
    > >
    > > The following is the error messge from IE:
    > > "HTTP 500 - Internal server error " after I invoked.
    > > And I went through step by step debugging, the same error message was
    > > shown, no further information.

    >
    > Turn off friendly errors in IE, then try again to see what the real error is.
    >
    >
    > --
    > Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
    > "Programming is an art form that fights back"
    >
    > Blog: http://blogs.atozed.com/kudzu
    >
    goodmannewz, May 11, 2005
    #5
  6. "=?Utf-8?B?Z29vZG1hbm5ld3o=?=" <>
    wrote in news::
    > specify a path("../XMLSchema1.xsd" or


    NEVER use relative paths.

    > "D:/Inetpub/wwwroot/WebService1/XMLSchema1.xsd" or


    This wont work, your slashes are wrong.

    > @"D:\Inetpub\wwwroot\WebService1\XMLSchema1.xsd") however all failed.
    > The error was the following:
    > Microsoft.Data.SqlXml.SqlXmlException: Schema: Cannot find the specified
    > schema file 'XMLSchema1.xsd'. --->


    Is the file actually in this location?


    --
    Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
    "Programming is an art form that fights back"

    Blog: http://blogs.atozed.com/kudzu
    Chad Z. Hower aka Kudzu, May 11, 2005
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Y2FtcHdlcw==?=
    Replies:
    1
    Views:
    1,720
    =?Utf-8?B?Y2FtcHdlcw==?=
    Oct 29, 2004
  2. Sandy

    JDBC vs SQLXML

    Sandy, Aug 10, 2005, in forum: Java
    Replies:
    0
    Views:
    337
    Sandy
    Aug 10, 2005
  3. JimP
    Replies:
    0
    Views:
    350
  4. [ mcberio ]

    Data.SqlXml not found on Web Service machine

    [ mcberio ], Jul 29, 2003, in forum: ASP .Net Web Services
    Replies:
    3
    Views:
    194
    Dave Beauchemin [MVP]
    Jul 30, 2003
  5. Don
    Replies:
    0
    Views:
    209
Loading...

Share This Page