|
Try using Trusted_Connection=True in your connection string.
Connection Strings[^] is a useful resource.
|
|
|
|
|
Thanks, I tried it but it made no difference, I figure yes and True works the same in this case.
|
|
|
|
|
Trusted_Connection=yes means SSPI=true, which uses windows authentication. It has happened to me that 'localhost' is not accepted as server name and you need to specify complete name of machine; eg: DTPXP_ABC_COMPUTER.
Please try same and check.
Also, do post error message as it makes us more good to help you.
modified and added: try checking un-checking anonymous login in IIS, as that could be reason you couldn't get through...
|
|
|
|
|
It says "The server could not be found or is not available".
Also, I did try to replace localhost with my computer's name, but it made no difference unfortunately.
What I've concluded after some reading is that I shouldn't be needing username and psw when I set Trusted_Connection to true.
Thanks,
Jop
|
|
|
|
|
No specific answers I'm afraid, but a few things which spring to mind.
Firstly http://www.connectionstrings.com is the thing I always use because I can't remember connection strings. I've checked that and what you have looks OK. I don't believe there's any case-sensitivity in them, but as one poster pointed out, get rid of the 'yes' and replace with 'true'.
In terms of username and password, SQL Server can run in two modes - SQL Server Authentication which has a username and password or Windows Authentication which uses your domain identity. The latter is preferred as you don't have to expose authentication details in config etc.
The only thing I can suggest is check that you have the relevant protocols switched on, particularly named pipes as this is what I believe local connections use by preference. Go to the SQL Server Configuration tool->SQL Server Network Configuration->Protocols and set them all on. I've been stung by that before...
Regards,
Rob Philpott.
|
|
|
|
|
Oh, its solved. Duh, well forget all that then.
Regards,
Rob Philpott.
|
|
|
|
|
|
I'm having trouble with getting data from a ms access database and displaying the data in a datagridview and importing some data back to the database.
It's so simple to most data types, but the data I mentioned above are kind of rich text not plain text, and I have already saved them as WORD OLE Objects in my database, I can view and edit them easily with MS Access database management system, but how to do those with my application?
Another problem of mine is how to show combo box columns in the datagridview when loading them from the database (I mean my database has some table with some combo box columns), I tried loading them to my datagridview (using AutoGenerateColumns = true) but the combo box columns in my database turned into text columns in my datagridview? I have already known a way to solve that by hiding the text columns and inserting new combo box columns into the datagridview (at right positions) instead or setting AutoGenerateColumns to false and adding new columns to the datagridview each one by one before filling its contents with a datatable.
Both those ways are not simple well, I wonder if we have another way easier?
The same ease you can find is when you load checkbox columns into your datagridview, it automatically displays them as checkbox columns without doing anything more, I wish we could do that way with combo box columns!
Could you please help me solve these!
Thank you so much!
Best Regards.
|
|
|
|
|
Hey there, everyone. I'm a long time member, but my responsibilities don't get me into code too often...so, please go easy on me
I'm using .Net 4.0, WCF and my goal is to call a webservice - one that is not known at compile time. Now I know that during development, I can right click > Add Service Reference, but that's not what I'm looking for..again the web service won't be known at compile time.
So, I've made it as far as to dynamically call a webservice and import all its contracts via the code below (taken from MSDN). And from that I can see all the different web service methods that are available in my webservice (in the string sWSDL at the very top).
My question, then: How can I call this web service? I understand the definition, but I don't understand how to invoke it. Any help would be much appreciated.
MetadataExchangeClient mexClient = new MetadataExchangeClient(new Uri(sWSDL), MetadataExchangeClientMode.HttpGet);
mexClient.ResolveMetadataReferences = true;
MetadataSet metaDocs = mexClient.GetMetadata();
WsdlImporter importer = new WsdlImporter(metaDocs);
ServiceContractGenerator generator = new ServiceContractGenerator();
object dataContractImporter;
XsdDataContractImporter xsdDCImporter;
if (!importer.State.TryGetValue(typeof(XsdDataContractImporter), out dataContractImporter))
{
Console.WriteLine("Couldn't find the XsdDataContractImporter! Adding custom importer.");
xsdDCImporter = new XsdDataContractImporter();
xsdDCImporter.Options = new ImportOptions();
importer.State.Add(typeof(XsdDataContractImporter), xsdDCImporter);
}
else
{
xsdDCImporter = (XsdDataContractImporter)dataContractImporter;
if (xsdDCImporter.Options == null)
{
Console.WriteLine("There were no ImportOptions on the importer.");
xsdDCImporter.Options = new ImportOptions();
}
}
System.Collections.Generic.IEnumerable<IWsdlImportExtension> exts = importer.WsdlImportExtensions;
System.Collections.Generic.List<IWsdlImportExtension> newExts
= new System.Collections.Generic.List<IWsdlImportExtension>();
foreach (IWsdlImportExtension ext in exts)
{
Console.WriteLine("Default WSDL import extensions: {0}", ext.GetType().Name);
newExts.Add(ext);
}
System.Collections.Generic.IEnumerable<IPolicyImportExtension> polExts = importer.PolicyImportExtensions;
importer = new WsdlImporter(metaDocs, polExts, newExts);
System.Collections.ObjectModel.Collection<ContractDescription> contracts
= importer.ImportAllContracts();
importer.ImportAllEndpoints();
</pre>
<div class="signature">Marcus Spitzmiller</div>
|
|
|
|
|
You might find this article[^] useful in helping to call the service.
|
|
|
|
|
hi
i try to connect to Oracle 11.2.0 64bit from my C# program
and i get this error:
Attempt to load Oracle client libraries threw BadImagFormatException.
This problem will occur when running in 64 bit mode with the 32 bit
Oracle client components installed.
what i need to download or change in my C# program ?
thanks in advance
|
|
|
|
|
|
As far as I know, you can't mix 32-bit and 64-bit components in one process. If your process is running in 64-bit mode, you need 64-bit libraries. If you want to use 32-bit libraries, run your process in 32-bit mode.
|
|
|
|
|
I have windows service project created with .NET 3.5 some time ago. It uses managed class library with native code via PInvoke. Recently 4.0 .NET version of that class library was created. I had to change windows service configurstion to 4.0 .NET client also.
Wierd problem started to appear after 4.0 version compilation. After about 1 minute of run service is terminated. In the Windows Events Application Error entry is created (event code 1000, task category (100)):
Application name: MyService.exe, version: 1.0.0.0, timestamp: 0x4d87107f
Module name: clr.dll, version: 4.0.30319.1, timestamp 0x4ba1d9ef
Exception code: 0xc00000fd
Error offset: 0x000ccd3c
Process id: 0x1680
Time: 0x01cbe7b1aaafc5a0
Application path: C:\projects\MyService\release\MyService.exe
Module path C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Report code: 024b8ca0-53a5-11e0-9963-544249093872
With 2 more entries in the events with information from Windows Error Reporting:
Contaier error , type 0
Event name: APPCRASH
Reply: No data
CAB Identifier: 0
Problem signature:
P1: MyService.exe
P2: 1.0.0.0
P3: 4d87107f
P4: clr.dll
P5: 4.0.30319.1
P6: 4ba1d9ef
P7: c00000fd
P8: 000ccd3c
P9:
P10:
With crash dump files reported to be found in C:\ProgramData\Microsoft\Windows\WER\ReportQueue\AppCrash_MyServ_c7f32a85ba9f45a9b76ff6beb5fac592fa5396f3_cab_047b1b2c
There is no specific point in the service it stops to work as I looked in the service logs dumped to text file. Any function call that follows after about 1 minute of work results in the termination. Service has a timer that fires with specific delays which invokes its functionality.
If I comment out managed class library call that uses native code the service termination stops. If I run the same class library with the same service functionality in original 4.0 console project there are no problems either.
Is there any 3.5 to 4.0 migration issues or bugs in 4.0 clr related to native code call in windows service applications?
Чесноков
|
|
|
|
|
I believe there are support cases opened against MS on this, and similar, issues. It may possibly have been fixed in the SP that was rolled out recently, but I cannot say for certain that it has.
|
|
|
|
|
Do you mean that is 3.5 to 4.0 conversion problem or generic problem for the windows service with 4.0 version?
Чесноков
|
|
|
|
|
It's a problem with the 4.0 version as far as I can tell (nothing to do with the conversion). A search of the web found a large number of variations on your problem here - not always a windows service, a long running windows forms app has the same problem.
|
|
|
|
|
Are they going to resolve the problem or are there any updates to 4.0 version or hot fixes?
I found just a couple of such reports having program crash once in a week e.g.
But here exactly after 1 minute it crashes. That is something to be a pattern
Чесноков
|
|
|
|
|
There are hot-fixes rolled up here[^], but there may be problems if you are using C++, so it's worth evaluating in a VM before you install it properly.
Details of what's in the compound fix can be found here[^].
|
|
|
|
|
In any case they are related to 4.0 only?
I've created 4.0 projects from scratch and migrated source code to them.
First service run was very promissing about 5 minutes without problems.
I stopped it and decided the reason was due to migation.
But the next service runs started to behave pretty wierd giving APPCRASH for mscoreei.dll 0xc0000005, and finally the same clr.dll 0xc00000fd without that 1 minute pattern as in 3.5->4.0 version.
Чесноков
|
|
|
|
|
That's correct. The issue seems to have been introduced with the V4 clr.dll.
|
|
|
|
|
I started to experiment with timer interval of the service processing functionality setting it to different values 30,10,15,1,0.5,0.1 seconds. At every timer event service performs some work in worker threads.
First there are the same clr.dll crashes with large timer intervals after exactly 10 calls to unmanaged class library. Then after I tried smaller ones the crashes disappeared. Occasionally there were few new ones:
Framework Version: v4.0.30319
Description: The process was terminated due to an internal error in the .NET Runtime at IP 6B50927D (6B290000) with exit code 80131506.
From the .NET runtime source. But now everything seems to work without problems. I wonder the reason of that erratic behaviour, every day new type of crash.
Have you tried http://support.microsoft.com/kb/2520479[^] yourself? Were there any problems with SP1 for VS Ultimate version with standalone SDK 7.1 installed?
Чесноков
|
|
|
|
|
Hi All,
I am back for eating everybodies head.
Attached is the excel file in which there are 3 formats of a same table in a report.
So based upon these 3 formats I have created 3 different rpt files.
Now the client is saying that he can anytime add any number of columns in any place and report should be generated. This means right now if you have look at the excel file, Format 2 has the highest number of column. But he can introduce fields in between or in the beginning or in the end.
Right now "Reading Before Adjustment" or "Reading After Adjustment" has 3 columns, but number of columns can either increase or decrease also.
So is it possible to dynamically create text object, assign them locations on the report and so on?
I did not find the facility of attachment. You can see the attachment here : Here[^]
Thanks and Regards,
|
|
|
|
|
you can read excel sheet in c#
from first cell to end cell...
and you will be insert into generic list from your data.
then you can sorting and searching...
show under code...
it's connect excel ole connect
-----------------
DataTable dtTempTable = new DataTable();
DataTable dtMyTable = new DataTable();
DataRow drMyRow;
int nRowCount = 0;
nRowCount = 0;
strSCell[0] = "A";
strSCell[1] = "1";
strECell[0] = "IV";
strECell[1] = "65536";
if (CommonLib.IsNullString(FileName.Substring(FileName.Length - 4, 4)).Equals("xlsx"))
{
strProvider = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=";
strProvider += (FilePath + FileName);
strProvider += @";Extended Properties=""Excel 12.0;Imex=1;HDR=YES;""";
strQuery = "Select * From [Sheet1$" + strSCell[0] + strSCell[1] + ":" + strECell[0] + strECell[1] + "]";
}
else
{
strProvider = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=";
strProvider += (FilePath + FileName);
strProvider += @";Extended Properties=""Excel 8.0;Imex=1;HDR=YES;""";
strQuery = "Select * From [Sheet1$" + strSCell[0] + strSCell[1] + ":" + strECell[0] + strECell[1] + "]";
}
OLEDBConnection = new OleDbConnection(strProvider);
OLECommandObject = new OleDbCommand(strQuery, OLEDBConnection);
OLEDBConnection.Open();
if (OLEReader != null)
{
if (!OLEReader.IsClosed)
OLEReader.Close();
}
OLEReader = OLECommandObject.ExecuteReader(CommandBehavior.CloseConnection);
dtTempTable.Load(OLEReader);
if (dtTempTable.Rows.Count > 0)
{
dtMyTable = dtTempTable.Copy();
}
if (OLEReader != null)
{
if (!OLEReader.IsClosed)
OLEReader.Close();
OLEReader.Dispose();
}
if (OLEDBConnection != null)
OLEDBConnection.Close();
return dtMyTable;
modified on Monday, March 21, 2011 7:01 PM
|
|
|
|
|
Please use the code block button to insert <pre></pre> tags around your code to make it readable. Check the posting guidelines at the top of this forum.
I must get a clever new signature for 2011.
|
|
|
|