|
I am not sure. Here is what MSDN[^] says
The play method begins playback of the current media item, or resumes playback of a paused item.
|
|
|
|
|
MemoryStream stream = new MemoryStream(); VisitorPhoto1.Image.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg);
byte[] pic = stream.ToArray();
error on second line......... pls help me thanks in advance
|
|
|
|
|
Which statement is the "second line"?
What are you trying to accomplish? Getting an image into a byte array? That shouldn't require a stream.
|
|
|
|
|
VisitorPhoto1.Image.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg); // second line
i want to store the image present in the picture box to sql database
|
|
|
|
|
amaankhan wrote: error on second line.
On VisitorPhoto1.Image.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg); ? if yes, either VisitorPhoto1 is NULL or VisitorPhoto1.Image is NULL .
|
|
|
|
|
hi all
i have a query written in MS access which check if variables exist in the table then dont inser but if not the variables are inserted twice this is my problem.below is the code
INSERT INTO IPAdress ( IP, Machine_Name)
SELECT '3', 'sss' from IPAdress WHERE NOT EXISTS
(SELECT null FROM IPAdress WHERE IP = '3' AND Machine_Name = 'sss' )
in oracle there is a dual table so the query can be modified a bit and it works fine.the query which works in oracle is
INSERT INTO IPAdress ( IP, Machine_Name)
SELECT '3', 'sss' from dual WHERE NOT EXISTS
(SELECT null FROM IPAdress WHERE IP = '3' AND Machine_Name = 'sss' )
|
|
|
|
|
Just leave out the first "from IPAdress".
Create your own dual table. ::shrug::
modified on Thursday, September 24, 2009 2:48 AM
|
|
|
|
|
|
Yeah, that works for SQL Server, but I didn't test it with Access.
|
|
|
|
|
Hi,
Consider the following:
public interface interface1
{
//some methods
}
public class A:interface1
{
//do something with methods in interface1
}
Now in the main class to create an object, can the following code be used:
interface1 I1 = new A();
is this a correct way? shouldn't it be
A a = new A();
If both the methods are correct what is the difference between the two?
Thanks.
|
|
|
|
|
Yes, but when accessing I1, you can only access the members defined by interface1, not other members defined in A.
So, you don't often do that, but there are times you may want to.
|
|
|
|
|
yes..the scenario is we want to access only the methods defined in the interface.So which method is better?
|
|
|
|
|
I wouldn't say either is better. In your example you seem to declare a local variable, which is unlikely to be a situation where using the interface is beneficial/required, so I would use the class.
Using an interface may be of benefit when declaring a field, a parameter, or a return type.
|
|
|
|
|
can you explain me how "Using an interface may be of benefit when declaring a field, a parameter, or a return type."...
Maybe with an example program would help me understand better.
|
|
|
|
|
Consider the following example for using interface as parameter
class Driver
{
IVehicle vehicleToDrive = null;
Driver(IVehicle vehicleToDrive){
this.vehicleToDrive = vehicleToDrive;
}
public void StartDriving() {
vehicleToDrive.Start();
vehicleToDrive.ChangeGear();
vehicleToDrive.Accelerate();
}
} In the above example, you are programming against an interface. The driver is generic and can drive any vehicle that implements IVehicle . In such situations interfaces are useful.
Following example shows how it is helpful in return types.
IVehicle vehicle = VehicleRepository.Create("Benz");
class VehicleRepository
{
public static IVehicle Create(string vehicleName)
{
IVehicle vehicle = null;
if(vehicleName == "Benz")
vehicle = new Benz();
else if(vehicleName == "Ford")
vehicle = new Ford();
return vehicle;
}
} VehicleRepository.Create method can implement any concrete type of vehicles without changing the return type.
Here is an example when it is used as field.
class BusinessValidation
{
IValidator[] validators = {
new NameValidator(),
new AgeValidator(),
new DesignationValidator() };
void Validate()
{
foreach(IValidator validator in validators){
validator.PerformValidation();
}
}
} Hope it is clear now.
|
|
|
|
|
thanks for the explanation. Now i understand it better.
|
|
|
|
|
shivapriyak wrote: So which method is better?
It depends. If you know the concrete type at the time of writing, use
A a = new A(); If you are using some factory method to create the instance, use
interface1 a = Create() This will help to change the underlying implementation without breaking the contract.
|
|
|
|
|
I have a scenario where we develop a class library which we give to the clients to use in their applications.
Inside the library we have implementations like:
IList<string> ModulesPath = new List<string>(16);
This 'ModulesPath' is used inside the class library (not exposed to the user). So is it correct to have 'ModulesPath' of type IList or List?
However we have another vaiable as:
IIAD i = InstrumentDomain.iad;
here 'IIAD' is a interface(which is in a separate class library) and 'InstrumentDomain' is the class which implements it(this is in a different class library.)
We give both the dlls to the client so that he can write a code as above.
So here, should 'i' be of type IIAD or of type InstrumentDomain i.e. the concrete class?
|
|
|
|
|
shivapriyak wrote: So is it correct to have 'ModulesPath' of type IList or List?
I'd use List ModulesPath = new List(16); here. Because, I know the concrete type is going to be List .
shivapriyak wrote: So here, should 'i' be of type IIAD or of type InstrumentDomain i.e. the concrete class?
This is a good place where writing IIAD i = InstrumentDomain.iad; makes more sense. It also allows you to add a different concrete type in future without making any changes in the contract.
|
|
|
|
|
thanks for the reply. Now i got it.
|
|
|
|
|
Using List also allows you to call its AsReadOnly method if you return it from the method:
public IList<T>
F<T>
(
)
{
List<T> result = new List<T>() ;
...
return ( result.AsReadOnly() ) ;
}
|
|
|
|
|
Dear All,
I want to implement the following functionality:
Read the mapping of the columns of excel and table from XML.
Create a dynamic query to insert the excel data into the columns of the table according to the mapping.
It should not insert in the identity column if any.
Plz help. Its very urgent.
Thanks in advance.
|
|
|
|
|
Member 4959176 wrote: Its very urgent.
This is considered impolite.
Show what you have done to implement this functionality and which parts you find do not work correctly. If you are expecting someone else to do the work for you, you are looking in the wrong place.
|
|
|
|
|
I converted the image to PDF.
I want to extract the PDF as 5 individual image files.
In that case its make a problem. In that PDF File has 5 images, its extracting as one jpg.
IF original PDF contains 5 images means, can extract as 5 individual jpg file
thats the problem for me.
thanks in advance...
|
|
|
|
|
You cannot be doing this without using a third party library. You should post in a forum for that library, or, at least tell us what library it is, and post some code, and hope that someone else here has used it.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|