Trying to use .Net Assembly - error : unable to cast type PBTransaction to c__n_tr

Hi,

I added a .Net Assembly created from PB12.1 to an ASP.Net
app.  When I try to use it I get and unable to cast object
of type 'Sybase.PowerBuilder.PBTransaction' to type c__n_tr.

This NVO needs to connect to a database, run a number of
functions and return a value and then disconnect.  The
asembly was created from a  PFC app being used in a legacy
two tier client server program. Everything seemed to deploy
without errors. I had successfully built a test PB windows
application that just opens a window, calls this nvo and it
runs ok and returns the value nicely.

I'll attach the full message verbage and  cs code .

Any help you can give is most appreciated.

Thank You,
Mike
0
Mike
1/5/2011 4:07:21 AM
sybase.powerbuilder.net 284 articles. 0 followers. Follow

2 Replies
728 Views

Similar Articles

[PageSpeed] 36

Mike,
Just built a simple POC - Assembly wrapping a datastore that returns 
data as xml.  I can reference and call it on a simple C# WinForm app. It 
returns the data.  One obvious difference is that I am using Transaction 
rather than pfc_n_tr.  Do you need n_tr?

On the assembly project - did you check "Verify CLS Compliance" when you 
build - CLS compliance is key for interop

-- 
Yakov
eLearnIT LLC
Twitter: http://twitter.com/eLearnPB
Blog: http://yakovwerde.sys-con.com
Web Site: http://www.eLearnITOnline.com

On 1/4/2011 11:07 PM, Mike Kennedy wrote:
> Hi,
>
> I added a .Net Assembly created from PB12.1 to an ASP.Net
> app.  When I try to use it I get and unable to cast object
> of type 'Sybase.PowerBuilder.PBTransaction' to type c__n_tr.
>
> This NVO needs to connect to a database, run a number of
> functions and return a value and then disconnect.  The
> asembly was created from a  PFC app being used in a legacy
> two tier client server program. Everything seemed to deploy
> without errors. I had successfully built a test PB windows
> application that just opens a window, calls this nvo and it
> runs ok and returns the value nicely.
>
> I'll attach the full message verbage and  cs code .
>
> Any help you can give is most appreciated.
>
> Thank You,
> Mike
0
Yakov
1/5/2011 2:48:32 PM
Yakov,
I cant unhook PFC from the application as this would be a
major rewrite.  In fact it was a major challenge to just
create the .net assembly without the window objects as I had
to reshuffle a lot of objects out of various pbls and then
reduce the pbl library list for the .net assembly.  In any
case I did get it to compile and I thought I had the
assembly proved out because the test app uses the same pbl
list and calls the nvo in the same  as the asp.net app calls
the .net assembly.

Based on your response I changeed my transaction object to
use sqlca rather than n_tr as you mention .  For some reason
I dont understand I'm still getting an error message
referring to n_tr. I verified I'm using the new dll.
I connect using an nvo which refers to a transaction object
sqlca as shown here:


SQLCA = CREATE transaction
SQLCA.DBMS="ODBC"
SQLCA.Database = "FPEDMBUS"
SQLCA.LogID = as_user
SQLCA.LogPass = ""
SQLCA.ServerName = ""
SQLCA.UserID =as_user
SQLCA.DBPass =""
SQLCA.Lock =' '
ls_connect="ConnectString='DSN=" + ls_dsn +
";UID=xxxxx;PWD=yyyyy'"
SQLCA.DBParm =ls_connect


CONNECT USING SQLCA;
IF SQLCA.SQLCode <> 0 then
	MessageBox("Error" + String(SQLCA.SQLCode) ,
SQLCA.SQLErrText)
end if

return SQLCA.SQLCODE;

As far as "Verify CLS Compliance" I didnt see where this is
specified on the deploy project tabs.  Do you mean .net
nullable type checkbox ?

What may help is if could debug the .net assembly as it's
being called.   I checked the debug choice while building
the assembly.  Not sure but maybe I'd spot something if I
stepped though the code.  Is this doable ?  If so, how do I
initiate that ?


Thank You,

Mike

> Mike,
> Just built a simple POC - Assembly wrapping a datastore
> that returns  data as xml.  I can reference and call it on
> a simple C# WinForm app. It  returns the data.  One
> obvious difference is that I am using Transaction  rather
> than pfc_n_tr.  Do you need n_tr?
>
> On the assembly project - did you check "Verify CLS
> Compliance" when you  build - CLS compliance is key for
> interop
>
> --
> Yakov
> eLearnIT LLC
> Twitter: http://twitter.com/eLearnPB
> Blog: http://yakovwerde.sys-con.com
> Web Site: http://www.eLearnITOnline.com
>
> On 1/4/2011 11:07 PM, Mike Kennedy wrote:
> > Hi,
> >
> > I added a .Net Assembly created from PB12.1 to an
> > ASP.Net app.  When I try to use it I get and unable to
> > cast object of type 'Sybase.PowerBuilder.PBTransaction'
> to type c__n_tr. >
> > This NVO needs to connect to a database, run a number of
> > functions and return a value and then disconnect.  The
> > asembly was created from a  PFC app being used in a
> > legacy two tier client server program. Everything seemed
> > to deploy without errors. I had successfully built a
> > test PB windows application that just opens a window,
> > calls this nvo and it runs ok and returns the value
> nicely. >
> > I'll attach the full message verbage and  cs code .
> >
> > Any help you can give is most appreciated.
> >
> > Thank You,
> > Mike
0
Mike
1/15/2011 12:35:07 PM
Reply:

Similar Artilces:

Sending SMS using vb.net or C#.net using vb.net or c#.net
Hi  My requirement is I hav one csv file with these fields id,mobilenum,messgae,status.intiallu staus is 0. once i read the all fileds and take that mobile number.using tat mobile number  i need to send sms .after sending sms i shuld change status as 1 How to send sms thru coding (please dont provide any links.if it is provide also please give working links becox i checked codeproject .i didnt get any nice link. and also provide the how to update the status field im csv file   Thank ssandhya   To send SMS, you need some third party SMS providers. if you consul...

.Net 2.0 Web application using Vb.net is unable to create object of another dll writen in C# .net 2.0
Hi, I habe created one ASP.net web application using Vb.net which is adding reference of dlls written in C# and .net 2.0. But whenever trying to create object of referencing dll, it is throwing error :Object reference does not set to an object. But, locally it is working fine,. In the server i have deployed the .aspx files and dll files in the bin. There were already an web.config in the server which is of .net 1.1. But checked it is retrieving value for that web.config correctly. Should i have to deply any other files and if not what can be the solution for this? Please help. Thanks, So...

Sample program using powerbuilder .net and asp.net
Hai, I am beginner in pb.net . So please can you provide me a sample program using powerbuilder web application with asp.net. with thanks and regards POLACHAN PAILY ---== Posted via the PFCGuide Web Newsreader ==--- http://www.pfcguide.com/_newsgroups/group_list.asp Part of the point of WebForms (and WinForms) is that you can deploy any application to these targets without recoding. So, for a sample app, take any sample that comes with PB. <g> No special coding required. Of course, you have to make sure your app isn't dependent on unsupported features. Good...

asp.net Unable to cast object of type 'ASP.masterpage_master' to type 'ASP.masterpage_master'
I am getting this error on my development PC when using Visual Studio 2005: asp.net Unable to cast object of type 'ASP.masterpage_master' to type 'ASP.masterpage_master'  I got this error some time ago.  I received a hotfix from microsoft which seemed to fix it.  Since then I have a new laptop so I do not have the hotfix installed but I have all the service packs installed for 2.0, 3.0, and 3.5 framework.  I was surprised to see this error again.  Why am I getting this error?  I know it has to do with referencing controls on my maste...

I'm trying to use an auto-complete extender from the asp.net ajax extensions toolkit. The application is using .net 3.5 web site, hosting in local IIS
I'm trying to use an auto-complete extender from the asp.net ajax extensions toolkit. The application is using .net 3.5 web site, hosting in local IIS. Does anyone have a workaround or solution for this?  Thanks in advance. A workaround or solution for what? JeffPlease: Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue....

Try to debug a asp.net project in vs.net using C#
Hi, I try to debug my project in vs.net. Everything is setup, and I can see the web service on a browser running by IIS. But when I try to press "Start" on the toolbar of vs.net, a pop-up tell me to input an account and password... The pop-up title: "Debuggin: user name and password required" I tried every user account in my computer( like IUSR_XXX, IWAM_XXX, XXX.... ), but no one is valid.... I also add them to the debbugging group, not working... Please help me! Thank you!! ok, I solved it by myself. just don't use the example code ...

How to use .Net assembly written in C# in powerbuilder?
How to use .Net assembly written in C# in powerbuilder? Assembly is written in C# and we create wrapper around it. We can see this activex control in the ACTIVEX test console of MS .Net Visual STudio. The control gets registered and can be seen in PB object browser but its not working when pasted on window. Can any one tell me why its happening and how to make it work? forums.sybase.com wrote: > How to use .Net assembly written in C# in powerbuilder? > > Assembly is written in C# and we create wrapper around it. We can see this > activex control in the ACTIVEX tes...

use VB.NET and C#.NET code in the same C#.NET project
All-- Here is a sample that is "off the beaten path", (at least for me). Is it possible, in an ASP.NET application, using the code-behind page building technique, to have both pages written in VB.NET and pages written C#.NET?At http://www.WebLogicArts.com/DemoList.aspx there is a sample that shows that, (contrary to popular belief), it IS possible to mix ASP.NET pages built with C#.NET with ASP.NET pages built with VB.NET in the same VS.NET 2003 project. Note that this is just a "fun" sample to see if it can be done and I do not recommend this practice as a "standard" way of develo...

Cross-Platform .NET Development: Using Mono, Portable.NET, and Microsoft .NET
Interesting book I came across: Cross-Platform .NET Development $49.99 doesn't hurt too much either :) NOTE: Availability: This item has not yet been released. You may order it now and we will ship it to you when it arrives. It's being released on September 30th, 2004 - one to keep an eye on...www.codingmayhem.com - VB.NET, C#, Silverlight, Javascript, HTML, CSS, T-SQL, MySQL and SQLitewww.headshotgamer.com - Gaming News and Reviews How about this book from Oreilly? Mono: A Developer's Notebook http://www.oreilly.com/catalog/monoadn/...

trying to send a simple email using system.net.mail, asp.net 2.0 etc.
I have the following code set to send a simple email to and from myself just for testing purposes.  I don't get any errors,  but I am not receiving the error. Any ideas what I am doing wrong? The following code gets executed when I click the submit button: Dim sMsg As String = ""sMsg += "Hello world" & vbCrLf sMsg += " Mr brown"  Dim from As MailAddress = New MailAddress("emailaddress@pascocountyfl.net")Dim sendto As MailAddress = New MailAddress("emailaddress@pascocountyfl.net")  Dim objemail As New MailMe...

Net:Net:Net::LDAP::FAQ
------_=_NextPart_001_01C6429F.D89AA417 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hello, Net::LDAP Net::LDAPS Is there a possible to LDAP bind with an encrypted (SHA, SSHA, CRYPT, ....) password? I don't like to write the secret password to the perl file. Best regards Barbara Wilbert ------_=_NextPart_001_01C6429F.D89AA417-- Wilbert Barbara (CI/OSI) * wrote: > Hello, > > Net::LDAP > Net::LDAPS > > Is there a possible to LDAP bind with an encrypted (SHA, SSHA, CRYPT, > ......

Trying to find Code Builder, Code Wizard, and Query Builder in Visual Studio.net using asp.net
I have a early version of Visual Studio at home and we're about to use Visual Studio.net 2003 at work. I'm using a book called 'Sams Teach yourself asp.net in 24 hours' and it has sections on the following topics: Code Builder, Code Wizard, and Query Builder. Here is a screen capture of the environment: http://www.asp.net/webmatrix/images/ShowImage.aspx?id=18 Is there a comparable environment in Visual Studio.net ?. I'm trying to learn from the examples in this book and was hoping there is a comparable environment but simply called something different. ...

Using .NET assembly through COM using cominterop
I have a .NET assembly that I call through COM in a classic ASP application using Cominterop.  It used to work fine, however, it's been some time and I've had to make a change and recompile it.  Unfortunately for me, I can't remember how I registered the thing to tell COM how to instantiate it, i.e running regsvr32 and passing the dll returns and error.  I have a .tlb file but I can't remember if I can use that to register the dll??  Hey it's been one busy couple of months!Need help. You could try PInvoke(platform Invoke) solution in this post.  Hope this help...

How to use winsock control in ASP.Net using VB.Net 2003?
I have to use winsock control in my ASP.net application. And don't have any idea to use it in ASP.net, but I have used it previously in VB.Net project. What I did in ASP.net  is-----I added its reference and also added it in toolbox. But it got added in Windows Forms section of toolbox. I dragged winsock control from tool box to a webform and named it as win1, then in code behind(i.e. aspx.vb) I tried to use it by typing win1 then one dot( . ) but it has not given any intellisence.So how could use winsock control in ASP.net.Can any send me link to a dummy project in which wins...

Accessing file twisely using asp.net using VB.Net
Hello Friends, I am new on this group. I have a problem in my functionality. i am using asp.net using vb.net. The pocess is as  a way that I have to send a mail with attachment.I am using Input file type tag control to get Attachment file from directory.After it i am saving attachment file on server folder.After it i am sending file path to attachment function as string.After it attachment is working fine. But after it i want to delete that file from server and when i wrote code  for delete fileas following: File.delete(Path of file) but when runtime start execute this code ...

Web resources about - Trying to use .Net Assembly - error : unable to cast type PBTransaction to c__n_tr - sybase.powerbuilder.net

Resources last updated: 1/9/2016 4:36:30 PM