Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 09-06-2009
Member
 
Join Date: Mar 2009
Posts: 27
how to generate sequence using vb.net express

I am using VB.net & trying to build a application for Office use & this Application is build for office information. I have created tables in it where every table has its on columns And are given the the primary key to each column. Now how can i create sequence in it....???
Reply With Quote
  #2  
Old 09-06-2009
Member
 
Join Date: May 2008
Posts: 2,293
Re: how to generate sequence using vb.net express

Here is an example with reference to generate sequence in Letters. This may help you alot....!

Code:
           char Letter = Char.Parse("A");
            int Count = 26;
            for (int i = 0; i < Count; i++)
            {
                    Response.Write(Letter);
                    Letter++;
            }
            Letter = Char.Parse("A");
            for (int i = 0; i < Count; i++)
            {
                Response.Write("A"+Letter);
                Letter++;
            }
Reply With Quote
  #3  
Old 09-06-2009
Member
 
Join Date: Apr 2008
Posts: 2,001
Re: how to generate sequence using vb.net express

Here another example working with SQL Server with C#

Code:
private void Test()
{
SequentialGuid = new SequentialGuid(Guid.Empty);
SequentialGuid++;
}


and C# code that increments GUIDs sequentially:

public class SequentialGuid
{
Guid _CurrentGuid;
public Guid CurrentGuid
{
get { return _CurrentGuid; }
}

public SequentialGuid()
{
_CurrentGuid = Guid.NewGuid();
}

public SequentialGuid(Guid previousGuid)
{
_CurrentGuid = previousGuid;
}

public static SequentialGuid operator ++(SequentialGuid sequentialGuid)
{
byte[] bytes = sequentialGuid._CurrentGuid.ToByteArray();
for (int mapIndex = 0; mapIndex < 16; mapIndex++)
{
int bytesIndex = SqlOrderMap[mapIndex];
bytes[bytesIndex]++;
if (bytes[bytesIndex] != 0)
{
break;
}
}
sequentialGuid._CurrentGuid = new Guid(bytes);
return sequentialGuid;
}

private static int[] _SqlOrderMap = null;
private static int[] SqlOrderMap
{
get
{
if (_SqlOrderMap == null)
{
_SqlOrderMap = new int[16] { 3, 2, 1, 0, 5, 4, 7, 6, 9, 8, 15, 14, 13, 12, 11, 10 };
}
return _SqlOrderMap;
}
}
}
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "how to generate sequence using vb.net express"
Thread Thread Starter Forum Replies Last Post
Import TGA sequence into Final Cut Pro Vivan Windows Software 6 31-05-2010 02:01 PM
PCI Express 2.0 card in a PCI Express 1.0 slot? Porfirioo Monitor & Video Cards 7 17-05-2010 09:09 AM
How to use the generate() in CPP Gaelic Software Development 5 15-02-2010 10:08 PM
Don't know about Sequence Containers Sonam Goenka Software Development 5 09-02-2010 02:10 PM
Usb pen drive sequence problem niljaviya Portable Devices 3 16-03-2009 06:44 PM


All times are GMT +5.5. The time now is 12:43 AM.