[Select id, name from My_Custom_Object__c where name:=name]
This will work if you know which object type you want. If you just have name and don't know what object it is, then its useless. We can retrieve a record without knowing its type only with ID and not name.
If you are using a controller extension try
myObject__c o = (myObject__c).controller.getRecord();
Hi,
This what u want?
String name = 'My Object Name';
[Select id, name from My_Custom_Object__c where name:=name]
This will work if you know which object type you want. If you just have name and don't know what object it is, then its useless. We can retrieve a record without knowing its type only with ID and not name.
Regards,
Arun.