Welcome to dbForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Need help with SQLXMLBulkLoad 3.0 in .NET

 
   Database Forums (Home) -> XML RSS
Next:  upgrading cluster hardware  
Author Message
laimaj




Joined: Sep 21, 2005
Posts: 1



(Msg. 1) Posted: Wed Sep 21, 2005 6:39 am
Post subject: Need help with SQLXMLBulkLoad 3.0 in .NET

Hi there, hope you can help.
I have a web service to bulk load data from xml to sql server - here's a code snippet:
--------------------------------------------------------------------
System.Threading.Thread.CurrentThread.ApartmentState = System.Threading.ApartmentState.STA;
SQLXMLBULKLOADLib.SQLXMLBulkLoad3Class objXBL = new SQLXMLBULKLOADLib.SQLXMLBulkLoad3Class();

objXBL.ConnectionString = ConfigurationSettings.AppSettings["connString"];
string schemaFile = ConfigurationSettings.AppSettings["schemaFile"];

objXBL.BulkLoad = true;
objXBL.KeepIdentity = false;
objXBL.XMLFragment = true;
objXBL.Transaction = false;
objXBL.Execute(schemaFile, data); //Data is a System.IO.MemoryStream, made of given xml
------------------------------------------------------------

I call this web service from external Windows Application. By saying external I mean separate solution.

Everything works just fine when I add a reference to service's dll and call it like that:

-------------------------------------------------------------
[STAThread]
static void Main()
{
Application.Run(new Form1());
}

private void btnSubmit_Click(object sender, System.EventArgs e)
{
MyService.Service1 svrDataImport = new MyService.Service1();

svrDataImport.objUserInformation = new MyService.UserInformation();
svrDataImport.objUserInformation.UserName = "login";
svrDataImport.objUserInformation.Password = "pass";

string msg = svrDataImport.LoadDataString(txtData.Text);
txtResult.Text = msg;
}
-------------------------------------------------------

As I said, it works fine like that. But I need to make to work it by adding NOT a reference to dll, but a Web reference. The code I use is a little bit different in this case:

----------------------------------------------------------
[STAThread]
static void Main()
{
Application.Run(new Form1());
}

private void btnSubmit_Click(object sender, System.EventArgs e)
{
MyAppl.MyService.Service1 svrDataImport = new MyAppl.MyService.Service1(); //MyService is a name of web reference

svrDataImport.UserInformationValue = new MyAppl.MyService.UserInformation();
svrDataImport.UserInformationValue.UserName = "login";
svrDataImport.UserInformationValue.Password = "pass";

string msg = svrDataImport.LoadDataString(txtData.Text);
txtResult.Text = msg;
}
----------------------------------------------------

The error occures on
objXBL.ConnectionString = ConfigurationSettings.AppSettings["connString"];
in web service. Could anyone, please, advice me?

 >> Stay informed about: Need help with SQLXMLBulkLoad 3.0 in .NET 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
SQLXMLBulkLoad - How do I specify the database schema for .. - Hi, If I prefix the table name with the schema it belongs to Example: sql:relation="LOYUS.BURN_REWARDS" I get the error: " Incorrect syntax near '.'. " Evertything works fine if I change it to sql:relation="BURN_REWARDS&quot...

Need help formatting XML using for XML explicit - Hi, Whenever I execvte the following: select 1 as tag,nvll as parent, '2.0' as [Docvment!1!Version], nvll as [DocvmentBody!2!DocvmentIdentifier], nvll as [DocvmentBody!2!] &#11...

FOR EXPLICIT - i don't think the docvmentation covld be more confvsing. Consider: CREATE TABLE MyNewsEntries( gvid vniqveidentifier, title varchar(200), description text, pvbDate datetime,...

SQL-ORACLE .net web application - Hello: I have a .net web application , that uses aspx.net and vb.net pointing to a SQL database. I need to send and receive data from oracle/Sql, so I am supposed to use XML. I haven't used it before and I have no idea how to do it, so I am..

import danych z xml do ms sql - Mam takie zapytanie bo mniej wiecej wiem jak odczytac plik taki xml i wrzucic go do sql. Ja probowalem za pomoca OpenXml: np. DECLARE @hdoc int DECLARE @doc varchar(8000) SET @doc =' <ROOT> <Customer CustomerID="VINET" ContactName=&qu...
   Database Forums (Home) -> XML All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]