Question

I downloaded the stored procedure generator template from this link:

http://www.mygenerationsoftware.com/TemplateLibrary/Template/?id=10998336-5037-496c-a163-050060de065a

Basically it generates Insert, Update, Delete, Select and LoadByPrimaryKey stored procedures by reading the schema.

However, when I run it is not working. I get error at this line:

For Each objColumn In objTable.PrimaryKeys

and the error that I get is:

Object doesn't support this property or method

Has anybody faced this problem? How do I resolve this?

Was it helpful?

Solution

The template code is not running through enumerations. Not sure whether this is a MyGeneration problem or a VBScript problem. In any case, in the template change code like this:

For each objColumn In objTable.PrimaryKeys

Change to:

For j=0 to objTable.PrimaryKeys.Count - 1
    Set objColumn = objTable.PrimaryKeys(j)

There are also instances of code like this:

For each objColumn In objTable.Columns

Change to:

For j=0 to objTable.Columns.Count - 1
    Set objColumn = objTable.Columns(j)

This worked for me (Windows 7, .Net 4.0, Sql Server 2008 R2, MyGeneration 1.3.1.1).

OTHER TIPS

I tried it, it is working correctly (mygeneration 1.3.9). Does the table have a Primary key? I think it is required in "doodad" to generate the stored procedures.

if all templates did not work, reinstall myGeneration (this happened with me).

vbScript in Windows 7 and up causes this issue with MyGeneration if you change the template scripting from Microsoft / VB Script to .NET.

It might work for your code and be faster than changing all the foreaches. I am using C# here but VB.NET is very similar in code format to VBScript so it is possible it will work without modification other than clicking the template configuration handle and changing the template language to .NET script.

After doing this - Change the NAME and the GUID of your template (press NEWGUID) - the GUID is the unique identifier YOU MUST CHANGE BOTH if you want to know what you are working with.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top