Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Web Services (http://www.velocityreviews.com/forums/f64-asp-net-web-services.html)
-   -   use sqlxml access database (http://www.velocityreviews.com/forums/t784990-use-sqlxml-access-database.html)

goodmannewz 05-10-2005 03:30 PM

use sqlxml access database
 
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.";
}

Chad Z. Hower aka Kudzu 05-10-2005 03:42 PM

Re: use sqlxml access database
 
"=?Utf-8?B?Z29vZG1hbm5ld3o=?=" <goodmannewz@discussions.microsoft.com>
wrote in news:5DEDC65A-A7DA-4B3A-A8AE-DCDBE374F95E@microsoft.com:
> 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 05-10-2005 10:51 PM

Re: use sqlxml access database
 
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=?=" <goodmannewz@discussions.microsoft.com>
> wrote in news:5DEDC65A-A7DA-4B3A-A8AE-DCDBE374F95E@microsoft.com:
> > 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 05-11-2005 05:33 AM

Re: use sqlxml access database
 
"=?Utf-8?B?Z29vZG1hbm5ld3o=?=" <goodmannewz@discussions.microsoft.com>
wrote in news:FAB3CFA2-112B-466F-AB12-E919CCFFA845@microsoft.com:
> 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 05-11-2005 12:11 PM

Re: use sqlxml access database
 
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.ISQLXMLCommandManaged Interface.ExecuteToOutputStream()
at Microsoft.Data.SqlXml.SqlXmlCommand.innerExecute(S tream strm)
--- End of inner exception stack trace ---
at Microsoft.Data.SqlXml.SqlXmlCommand.ExecuteStream( )
at Microsoft.Data.SqlXml.SqlXmlCommand.ExecuteXmlRead er()
at Microsoft.Data.SqlXml.SqlXmlAdapter.Fill(DataSet ds)
at WebService1.Service1.test() in
d:\inetpub\wwwroot\webservice1\service1.asmx.cs:li ne 76

Thanks again.

Ryan


"Chad Z. Hower aka Kudzu" wrote:

> "=?Utf-8?B?Z29vZG1hbm5ld3o=?=" <goodmannewz@discussions.microsoft.com>
> wrote in news:FAB3CFA2-112B-466F-AB12-E919CCFFA845@microsoft.com:
> > 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 05-11-2005 04:06 PM

Re: use sqlxml access database
 
"=?Utf-8?B?Z29vZG1hbm5ld3o=?=" <goodmannewz@discussions.microsoft.com>
wrote in news:F407C801-0A09-4CD1-A4C4-047AC7DC910A@microsoft.com:
> 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


All times are GMT. The time now is 11:23 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.