Home

UniData UODotNet ASP.Net C# UniSelectList

There's this DLL, UODOTNET.DLL. Park it in the Bin folder and use it via

using IBMU2.UODOTNET;

Then rock on with this code...

        UniSession mysession = UniObjects.OpenSession("serverIP", "UniDataUser", "UniDataPass", "UniDataAcctLocation", "udcs");

        UniCommand mycommand = mysession.CreateUniCommand();
        mycommand.Command = "SELECT UNIDATAFILE";
        UniSelectList myselect = mysession.CreateUniSelectList(0);
        mycommand.Execute();

        string qwe = "";

        while (!myselect.LastRecordRead)
        {
            string s = myselect.Next();
            qwe += "<a href = \"bbb.aspx?id=" + s + "\">" + s + "</a><br />";
        }

        MyShow.Text = qwe;

What's the script?

First line creates a session. UniDataAcctLocation would be the account or what normal folks refer to as the database's location. Along the lines of C:\UniData\MyDataFiles

Second line creates a command for us to use on the next line

Next create the command in text. A simple SELECT  then the name of the file, or in real terms the table, will return a list of the primary IDs. Being the primary ID is best, they have to be unique and indexed etc so stick with 'em

We seem to create a select list but do nothing with it really. It's just there floating around in the RAM.

Execute the command. Simples. But without any guidance or pointing it seems the results from the command have ended up in the uniselectlist. I'd normally expect to say "ok, run this command and park the results into the select list" or my command.execute(myselectlist). Ho hum, it's UniData so it's the Dark Arts.

The while loops through the select list until the last record. Might be worth checking it actually INCLUDES the last record, not done that yet. myselect.next I figure is a pointer to the next item in the list

Reader's Comments

Post Your Comment Posts/Links Rules

Name

Comment

Add a RELEVANT link (not required)

Upload an image (not required)

No uploaded image
Real person number
Please enter the above number below




Home
Admin Ren's Biking Blog