|
A person literally reading the string?
|
|
|
|
|
|
Your Intellisense string. itself has some good ones.
|
|
|
|
|
Have just developed a windows applicatiion with a SQL 2000 Server as a backend. I however want to display a report on a web browser offline from the SQL 2000 Server.
Can anyone help on this procedure?
|
|
|
|
|
Can you explain a bit more clearly what you are trying to accomplish. Are you trying to display a report generated from data from the SQL Server but you want to be able to view this when the server is not online?
|
|
|
|
|
Hello
I've a question about FormatConditions (Interop.Excel)
I need sent to parameter a string empty value, however in execution mode, the app throw a exception "Additional information: The parameter is incorrect."
See the code below:
rng.FormatConditions.Add(XlFormatConditionType.xlCellValue,XlFormatConditionOperator.xlEqual,"",Type.Missing);
How can I sent a empty string param?
Thks all
|
|
|
|
|
What are you trying to accomplish, a conditional format which checks for an empty string or to delete an existing conditional format. If the former have you tried:
rng.FormatConditions.Add(XlFormatConditionType.xlCellValue, XlFormatConditionOperator.xlEqual, "\"\"", Type.Missing);
Which is an escaped "" sequence, i.e. you're passing "" to the function not an empty string (0 characters in length).
|
|
|
|
|
Hi,
I am having a problem of storing a string into TVReturn.amortization.data[0].balanceAmount (class definitions are given below), where I get the error message saying: System.NullReferenceException: Object reference not set to an instance of an object
at this line where I am testing inserting values into the amortization schedule data
tvret.amortization.data[0].balanceAmount = Convert.ToDecimal("100000");
I have the following class definitions:
public class TVReturn
{
public decimal unknownEventAmount;
public double unknownNominalAnnualRate;
public int unknownEventNumber;
public string cashFlowDataXml;
public TVAmortizationSchedule amortization;
}
public class TVAmortizationSchedule
{
public TVAmortizationData[] data;
}
public class TVAmortizationData
{
public int sequenceNumber;
public string eventDate;
public decimal paymentAmount;
public decimal interestAmount;
public decimal principalAmount;
public decimal balanceAmount;
}
|
|
|
|
|
Abbas82 wrote: TVAmortizationData[] data;
This creates an array. Every object in that array is null, until you call new on it. This is why you're getting this error.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: This creates an array. Every object in that array is null, until you call new on it. This is why you're getting this error.
How would I call the new on it? I instantiate the TVReturn object like so
TVReturn tvret = new TVReturn();
what would be my next step?
|
|
|
|
|
You must initialize data like so:
data = new TVAmortizationData [10 ];
you'll probably want to do this in the constructor of the class TVAmortizationSchedule
|
|
|
|
|
jimmanuel wrote: You must initialize data like so:
data = new TVAmortizationData [10 /* 10 is arbitrary, make the array whatever size you want */];
I changed the class to the following, but I still get the same message.
public class TVAmortizationSchedule
{
public TVAmortizationData[] data;
public TVAmortizationSchedule()
{
data = new TVAmortizationData[5];
}
}
|
|
|
|
|
TVAmortizationData[] data = new TVAmortizationData[10];
data[0] = new TVAmortizationData();
...
|
|
|
|
|
I've developed a webservice serving a data set. This is the code:
-----------------------------------------------------------------
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Data;
using System.Data.SqlClient;
[WebService(Namespace = "http://localhost/WSTest/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class ERPService : System.Web.Services.WebService
{
public ERPService () {
}
[WebMethod]
public DataSet listaEntidades() {
SqlConnection con = new SqlConnection("[hidden for security reasons]");
SqlDataAdapter daEntidade = new SqlDataAdapter("SELECT * FROM Entidade", con);
DataSet ds = new DataSet();
con.Open();
daEntidade.Fill(ds, "Entidade");
con.Close();
return ds;
}
}
-----------------------------------------------------------------
It works fine in the browser but when I create a new window project and try to add this service as a data source to bind it to a DataGridView, the interface does not add the DataSource to the window.
It reconizes the service ok the reference is added to the project but no data source is displayed.
What's wrong?
André Pires
|
|
|
|
|
Hi all.
Is there a way of Closing or releasing a CryptoStream without closing the underlying stream?
I've created a helper class that encrypts and decrypts streams. The problem is that if I call Clear() or Dispose() on my CryptoStream in order to release the resources its using I'm also closing the underlying Encrypted Stream I'm passing out of my Method.
I could always copy the encrypted stream to a new one (MemoryStream copyStream = new MemoryStream(encryptedStream.ToArray()) and then close the CryptoStream but I cant believe thats the only solution.
Or is it valid not to Close/Dispose a CryptoStream?
thanks for any help.
|
|
|
|
|
You can try Flush .
Personally I don't think that I've had a problem with opening a MemoryStream , then a StreamWriter on top of that, closing the StreamWriter and I was still able to access the MemoryStream .
|
|
|
|
|
Hi Ed,
thanks for the reply.
Flush() will only make the CryptoStream write anything left in the buffer to the underlying stream but it wont release/dispose the CryptoStream itself.
Normally Streams don't close an underlying stream when they are disposed. But this is not the case with Compression streams (GZipStream) or CryptoStream, where the underlying stream will get closed when you dispose the GZipStream or the CryptoStream.
In the case of a GZipStream there is an easy way around it because you can directly specify in the constructor if you want to leave the underlying stream open or not when you dispose the compression stream (by default it will close it). This option however is not availabe in the CryptoStream constructor and it will always close the underlying stream when you dispose/close/clear it. I was wondering if there is anyway around this issue or if making a copy of the uderlying stream is the only way.
|
|
|
|
|
I wouldn't have thought so then, you might want to take a look through the CryptoStream's methods with Reflector, I've always found it useful.
I've just taken a look through and the CryptoStream does not override the Close method so defaults to Stream's Close method which in turn calls the Dispose method, which kinda sucks
So no it doesn't look as though you can without copying the entire stream
|
|
|
|
|
Just checked it out with Reflector and yeah you're right, there's no way around it.
It'll close the underlying stream.
thanks for the tip about Reflector.
|
|
|
|
|
gumi_r@msn.com wrote: thanks for the tip about Reflector.
Saved my ass more than once
|
|
|
|
|
|
|
thanx, and good idea but im working on that stinky RAS thing which i dont seem to quite handle.. i actuall want to disconnect a remote adsl modem connected to the server "really disconnect not fool around ", basically my company wants to cut down running costs like this one which i have to disconnect just after 4 hours of daily usage.. this's what im trying to do..
try
{
RASCONN lprasConn = new RASCONN();
lprasConn.hrasconn = IntPtr.Zero;
IntPtr m_ConnectedRasHandle;
m_ConnectedRasHandle = lprasConn.hrasconn;
RAS.RasHangUp(m_ConnectedRasHandle);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
thanx a million code-frog for trying to help, but never mind, nobody seems to know how to solve this
ps. i tried this article as well.
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
I said before: you're passing a null handle into RasHangUp which will be returning an error code. You need to pass it a handle to the connection you want to disconnect, which will be the one returned from RasDial if you created the connection, or one you get back from RasEnumConnections .
|
|
|
|
|
Thank you Mike
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|