Wednesday, March 7, 2012
Error connecting to datasource using bulk load
elsewhere in the application to call stored procedures and retrieve the
data to display. This is the only place within the application that I am
unable to connect. I suspect it has to do with the fact that I am
calling within a single thread. Here is the connect string:
"Data Source=(local);Initial Catalog=IOC;User
ID=sg2user;password=sg2user"
franksag
Posted via http://www.codecomments.com
Try setting the Provider=sqloledb value in the connection string. Here's an
example from our docs of Bulkload in .NET:
[STAThread]
static void Main(string[] args)
{
try
{
SQLXMLBULKLOADLib.SQLXMLBulkLoad3Class objBL = new
SQLXMLBULKLOADLib.SQLXMLBulkLoad3Class();
objBL.ConnectionString =
"Provider=sqloledb;server=server;database=database Name;integrated
security=SSPI";
objBL.ErrorLogFile = "error.xml";
objBL.KeepIdentity = false;
objBL.Execute ("schema.xml","data.xml");
}
catch(Exception e)
{
Console.WriteLine(e.ToString());
}
}
"franksag" <franksag.1llvtp@.mail.codecomments.com> wrote in message
news:franksag.1llvtp@.mail.codecomments.com...
> thanks for getting back to me. I am able to connect to the database
> elsewhere in the application to call stored procedures and retrieve the
> data to display. This is the only place within the application that I am
> unable to connect. I suspect it has to do with the fact that I am
> calling within a single thread. Here is the connect string:
> "Data Source=(local);Initial Catalog=IOC;User
> ID=sg2user;password=sg2user"
>
> --
> franksag
> Posted via http://www.codecomments.com
>
Error connecting to datasource using bulk load
The first issue I ran into was not being able to do a bulk load in a
multi-threaded environment. So I now have initiated a new thread prior
to trying to execute the bulk load. I am consistenly getting an unable
to connect to data source error. Does anyone have any ideas as to what
I may be doing incorrectly? The connection string is the same one I
use in other places without any issues.
Private Sub BulkLoadXML()
Dim bulkload As New Thread(New ThreadStart(AddressOf
ExecuteBulkCall))
bulkload.ApartmentState = ApartmentState.STA
bulkload.Start()
bulkload.Join()
End Sub
Private Sub ExecuteBulkCall()
Dim _bulkInstance As New SQLXMLBulkLoad3Class
_bulkInstance.ConnectionString = _strConn
_bulkInstance.ErrorLogFile = "c:\temp\xmlerror.log"
_bulkInstance.KeepIdentity = False
_bulkInstance.Execute("c:\SampleSchema.xsd",
"c:\SampleXMLData.xml")
End Sub
franksag
Posted via http://www.codecomments.com
What does the connection string look like? When you say it worked in other
places - what places are those?
Andrew Conrad
Microsoft Corp
Error connecting to datasource using bulk load
rst issue I ran into was not being able to do a bulk load in a multi-threade
d environment. So I now have initiated a new thread prior to trying to exec
ute the bulk load. I am consistenly getting an unable to connect to data so
urce error. Does anyone have any ideas as to what I may be doing incorrectly
? The connection string is the same one I use in other places without any i
ssues.
Private Sub BulkLoadXML()
Dim bulkload As New Thread(New ThreadStart(AddressOf ExecuteBulkCall
))
bulkload.ApartmentState = ApartmentState.STA
bulkload.Start()
bulkload.Join()
End Sub
Private Sub ExecuteBulkCall()
Dim _bulkInstance As New SQLXMLBulkLoad3Class
_bulkInstance.ConnectionString = _strConn
_bulkInstance.ErrorLogFile = "c:\temp\xmlerror.log"
_bulkInstance.KeepIdentity = False
_bulkInstance.Execute("c:\SampleSchema.xsd", "c:\SampleXMLData.xml")
End SubWhat does the connection string look like? When you say it worked in other
places - what places are those?
Andrew Conrad
Microsoft Corp|||thanks for getting back to me. I am able to connect to the database elsewhe
re in the application to call stored procedures and retrieve the data to dis
play. This is the only place within the application that I am unable to conn
ect. I suspect it has to do with the fact that I am calling within a single
thread. Here is the connect string:
"Data Source=(local);Initial Catalog=IOC;User ID=sg2user;password=sg2user"|||Try setting the Provider=sqloledb value in the connection string. Here's an
example from our docs of Bulkload in .NET:
[STAThread]
static void Main(string[] args)
{
try
{
SQLXMLBULKLOADLib.SQLXMLBulkLoad3Class objBL = new
SQLXMLBULKLOADLib.SQLXMLBulkLoad3Class();
objBL.ConnectionString =
" Provider=sqloledb;server=server;database
=databaseName;integrated
security=SSPI";
objBL.ErrorLogFile = "error.xml";
objBL.KeepIdentity = false;
objBL.Execute ("schema.xml","data.xml");
}
catch(Exception e)
{
Console.WriteLine(e.ToString());
}
}
"franksag" <franksag.1llvtp@.mail.codecomments.com> wrote in message
news:franksag.1llvtp@.mail.codecomments.com...
> thanks for getting back to me. I am able to connect to the database
> elsewhere in the application to call stored procedures and retrieve the
> data to display. This is the only place within the application that I am
> unable to connect. I suspect it has to do with the fact that I am
> calling within a single thread. Here is the connect string:
> "Data Source=(local);Initial Catalog=IOC;User
> ID=sg2user;password=sg2user"
>
> --
> franksag
> ---
> Posted via http://www.codecomments.com
> ---
>
Sunday, February 26, 2012
Error connecting to .sdf database
Dear All,
I am trying to connect to a .sdf database. I am building a console application. First I got an error "Could not load file or assembly 'System.Data.SqlServerCe, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)". Then I manage to solve "Unable to load DLL 'sqlceme30.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)". So wat is the possible error on my side ?
Is it not amazing. I have been searching the forums for a solution to this specific problem for weeks now and everyone that answers has no idea what it is we are requesting. you get redirected to a thousand other sites that still can not answer this question. I dont think anyone knows how to solve this!
|||Which version of the product are you using?
Checking the basics first: Is the product installed on your machine ( check in Add and remove programs).Also check that the System.Data.SqlServerCe.dll is in GAC (C:\windows\assembly).
If your installation was correct, then sqlceme30.dll (and other dlls) should be loaded automatically using some registry settings.
Btw, did you try reinstalling the runtime package on your machine?
Error connecting to .sdf database
Dear All,
I am trying to connect to a .sdf database. I am building a console application. First I got an error "Could not load file or assembly 'System.Data.SqlServerCe, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)". Then I manage to solve "Unable to load DLL 'sqlceme30.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)". So wat is the possible error on my side ?
Is it not amazing. I have been searching the forums for a solution to this specific problem for weeks now and everyone that answers has no idea what it is we are requesting. you get redirected to a thousand other sites that still can not answer this question. I dont think anyone knows how to solve this!
|||Which version of the product are you using?
Checking the basics first: Is the product installed on your machine ( check in Add and remove programs).Also check that the System.Data.SqlServerCe.dll is in GAC (C:\windows\assembly).
If your installation was correct, then sqlceme30.dll (and other dlls) should be loaded automatically using some registry settings.
Btw, did you try reinstalling the runtime package on your machine?