Connecting to Sybase via Scripting Functoid using a VB.NET Class

I was given the requirement to pull information from a Sybase Database to cross reference and ID. I’ve had a similar requirement in pulling data from a SQL stored procedure, so this was pretty similar.

First I used the Sybase.Data.AseClient.dll and the sybdrvado11.dll provided by Sybase as part of their client install. Both of these .dll’s need to be installed into your ..\Program Files\Microsoft BizTalk Server 2006\ folder.

I created a VB.NET class that contains the function that brings in the ID I needed to cross reference and the connection string to the Sybase database.

The connection string is in the format Data Source=<IP Address>;Port=<Port Number>;Database=<Database Name>;UID=<UserName>;PWD=<Password>;Max Pool Size=50;Min Pool Size=5″

Here is the VB.NET class with accompanying comments.

Imports System.Data
Imports Sybase.Data.AseClient
Imports System.Xml

Public Class DatabaseConnectionClass

Public Function ReturnNEWID(ByVal OLD_ID As String, ByVal ConnectionString As String) As String

‘Create Connection
Dim conn As New AseConnection(ConnectionString)

‘Open a Connection to the Database
conn.Open()

‘Create the SQL Statement
Dim sql As String = “SELECT Field from TABLE WHERE ID= ‘” + OLD_ID+ “‘”

‘Retrieve the Data
Dim cmd As New AseCommand(sql, conn)

‘Return the Data Reader Object
Dim reader As AseDataReader = cmd.ExecuteReader()

‘Populate the Return Value

While reader.Read()
Return reader.GetString(0)
End While

‘Close the DataReader and Connection objects
reader.Close()
conn.Close()
End Function

End Class

I signed the class with a strongly named key, built and GAC the class, and referenced it as an external assembly.

When I test the map it correctly pulls from the Sybase database.

Free BizTalk Skills Assessment Quiz from Quick Learn

Free BizTalk Skills Assessment Quiz from Quick Learn

As with any certification one of the hardest things is deciding if and when you are ready to sit the exam. The BizTalk 2006 exam will test you on general BizTalk development, deployment, BAM and business rules and you will have to have quite a bit of real world hands-on experience to get a good score.

If you want to measure up your skills, Quick Learn has a free practice test on their site. The test was developed so that students can assess their skills and see if they have the experience required to take the advanced BizTalk Deep Dive course. The practice test is focused on general development, so you will still need to know about rules, BAM, and deployment and maintenance. But if you get a good score and are fairly comfortable with the other topics, then go for it and take the real exam.

If you feel you need to skill-up, you should consider attending a Deep Dive or Immersion course dependant on your experience. Both courses have been updated to cover the BizTalk 2006 R2 functionality, and the Deep Dive is aimed at getting you up to the required level for the exam. Even if you think you know your stuff you will benefit from a Deep Dive course. I have been teaching BizTalk Deep Dive for over two years now and I still learn a lot from the technical discussions that take place in a class of BizTalk experts over the five days.

The quiz is here.

_qacct=”p-03-ZsKAm7O3lI”;quantserve();

Quantcast

Fixing exception messages on the .NET Compact Framework 3.5

FWIW: I recently ran into trouble while developing for the .NET Compact Framework, v3.5. Upon all exceptions, the framework would tell me:


An error message is available for this exception but cannot be displayed because these messages are optional and are not currently installed on this device. Please install ’NETCFv35.Messages.EN.wm.cab’ for Windows Mobile 5.0 and above or  ’NETCFv35.Messages.EN.cab’ for other platforms. Restart the application to see the message.


Interpreting the message as ‘I have to run the NETCFv35.Messages.EN.wm.cab (I’m developing an application for WM6) on my device’, I copied the file from C:\Program Files (x86)\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE\Diagnostics onto my mobile device and ran the installation.


To no avail, nothing changed and I was stuck. After installing the ‘Power Toys for .NET Compact Framework 3.5’, however, I configured logging using the ‘.NETCF Logging Configuration’ application and found the following error for the loader log:


‘Attempt to load [\Program Files\SomeApp\System.SR.dll] has failed (err 0x80001000).’


Renaming the file ‘SYCCFA~1.001’, included in the aforementioned CAB file into System.SR.dll and adding it as a reference in my application proved to fix the issue. I now had readable exception messages.


Just jotting this down as there’s nothing to be found on the web regarding the issue that I could find.

Curso "Certified Scrum Master" – 30-31/Jan/08

Curso "Certified Scrum Master" – 30-31/Jan/08

A Fullsix est%u00e1 a organizar um curso de Certified Scrum Master, que vai ser leccionado por Mitch Lacey em Lisboa, no final de Janeiro, com dura%u00e7%u00e3o de dois dias.

Pessoalmente tenho tido algum sucesso na utiliza%u00e7%u00e3o de Scrum, apesar de ser muito f%u00e1cil fugir a usar todas as pr%u00e1ticas da abordagem, e considero que o conhecimento (se n%u00e3o a utiliza%u00e7%u00e3o) de metodologias %u00e1geis como absolutamente essencial no desenvolvimento de software. Vivamente recomendado!

Early spring cleaning

Early spring cleaning

So I was cleaning out my desk and found something that I would have blogged about
had I had a blog when it happened 🙂

People tend to think of me as a BizTalk guy – but before that I was really an ASP
and then ASP.NET guy.  On one of the early ASP.NET mailing lists Scott
Guthrie
challenged us to write an application that hosted ASP.NET outside of IIS
(this of course if now all documented – but it wasn’t at the time).  I was the
first (or one of the first) people to do this (the only thing I remember is having
to use PInvoke and LoadLibrary to load the aspnet_isapi.dll into the process for stuff
to work) and he sent me a hat (which I still have somewhere) and a signed .NET Framework
CD.  Fun days.

Also funny that my next post will likely be able hosting ASP.NET outside of IIS.



Check out my BizTalk
R2 Training.

Customizing TFS Team Build build numbers…

If you feel the need to customize your TFS Team Build number, it appears there are
some (non-obvious) rules for doing so.  I wanted to add the latest changeset
number (scoped to the branch I was building) on to the end of the build number as
a suffix.  I’m using a combination of the TfsVersion task from the MSBuild
Community Tasks and a custom task called within BuildNumberOverrideTarget.

My first cut was to simply take the default generated build number (like Dev_20071231.4)
and add an underscore followed by the changeset number.  Like, say, Dev_20071231.4_335. 
This worksexactly once.  After that you get the following error message:

TF42054: Team Foundation could not start the build. Please check the event log
on the build machine for additional information.

None of the tracing
flags for MSBuild seem to shed any light.  Your build type is basically toast,
until you delete
the build (and change your build number customization logic.)  Then I discovered
that this was, at least to some degree, a known
issue.  What I don’t think is so well understood is that even if you take
complete control of your build number generation, you really want to leave an incrementing
number at the end of the build number so that:

  1. You can guarantee uniqueness even when every other component of the build number remains
    the same – since Team Build requires this.

  2. To accomodate the fact that before you get a chance to customize the build number,
    Team Build runs parsing logic on the last build to try to determine what
    the new (default) build number should be.  If this parsing logic fails, you’ll
    get the above error. 

Ultimately I wound up generating something like this: Dev_1.0_20071231.44.2. 
It has these components:

  • Build type

  • Release “friendly name” (any string)

  • Date stamp

  • Latest changeset number for the branch

  • Incrementing number

I borrowed from the sample here,
and wound up with this.  I’ll write more
shortly about whether there are any behavior differences to be aware of in TFS
2008.