Showing posts with label array. Show all posts
Showing posts with label array. Show all posts

Monday, March 12, 2012

Lookup Arrays

I need to load an array of order numbers.. Then later I need to be able to
'lookup' in that area for a specific order number (for example one that user
keys into text box).
how is this accomplished? ive researched Array and Arraylist and cannot
figure how without a bunch of work.
There must be something simple for this.
Can you help?
Thanks.
jrHello Jr,
Welcome to the MSDN newsgroup.
From your description, you have an order number list which want to be
stored in a list container and you'll lookup some certain order numbers
from that container later in your SQL Reporting service's report, correct?
Based on my experience, since these code should be in your custom code
period or an separate assembly, so you're using them as custom code or
custom assembly in your report , right? If this is the case, what
available to us are all those utility or collection classes in the .net
framework system.collections namespace(Such as the Array, ArrayList you
mentioned).
For your scenario, I'm wondering how will you identify a certain order
number? Just through the orderID or will you give each order number another
identity(a key value) for lookup? Here are two generic cases:
1. If you just want to get the order item's index in the container(such as
Array) through the order number(suppose its of string type), you can just
Array.IndexOf method to locate a certain item in the Array:
#Array.IndexOf, m¨¦thode (Array, Object)
http://msdn2.microsoft.com/fr-fr/library/7eddebat.aspx
Here is a simple test class which intializing the Array(orderList) in the
type's static initializer and expose a public static method for lookup item
index in the array:
==================public class ArrayUtil
{
public static string[] OrderArray;
public ArrayUtil()
{
}
static ArrayUtil()
{
OrderArray = new string[10];
for (int i = 0; i < OrderArray.Length; i++)
{
OrderArray[i] = "Order_" + i;
}
}
public static int FindOrder(string num)
{
return Array.IndexOf(OrderArray, num);
}
}
=====================
2. If each order nunber will be stored with an identity value as the lookup
key, I think the "HashTable" class is the reasonable choice. HashTable
class support storing multiple key/value pairs and have method for looking
up a certain item in it via its key value:
#Hashtable Class
http://msdn2.microsoft.com/en-us/library/system.collections.hashtable.aspx
Hope this helps. If there is any paricular concerns in your scenario or if
you have any other ideas ,please feel free to post here.
Regards,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)|||Hello Jr,
How are doing on this issue, have you got any progress or does my last
reply helps you a little on this? If you have anything unclear or still
anything else we can help, please feel free to post here.
Regards,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Saturday, February 25, 2012

Looking for physical design suggestions...

I got a server that has a RAID-5 array partitioned into C: and D:
drives (OS Win2K Adv. Server installed on C:). The server also has a
mapping to a NAS device using the latest protocols that trick the
system into thinking the map is actually a local SCSII drive. That's
drive X:.
This server is used only for SQL, and contains an OLTP database that
sees a lot of use and is pretty heavily indexed.
I am toying with the idea of centralizing my data storage on the NAS
(data center network segment is 1-gigabit ethernet). So I was
thinking about putting my primary data file on the NAS (drive X:) and
keeping all tables there, creating a secondary data file on local
RAID-5 (drive D:) and putting all non-clustered indexes there, as well
as keeping the tempdb there and specifying the sort in tempdb option.
Log files would also remain on D:.

If anyone can suggest a better scenario given the above setup - I'd
love to hear it. Much appreciated.

Alexey AksyonenkoAlthough it is technically possible to put SQLServer database files on a NAS
drive, this is not supported by Microsoft and they strongly recommended that
you don't do it. With a NAS drive you lose many of the benefits of a
client-server database, you will get poor performance and you risk
corrupting your data.

Databases belong on direct-attached or SAN storage.

--
David Portas
----
Please reply only to the newsgroup
--

"Alexey Aksyonenko" <Alexey.Aksyonenko@.coanetwork.com> wrote in message
news:1449e414.0309260612.7558f05f@.posting.google.c om...
> I got a server that has a RAID-5 array partitioned into C: and D:
> drives (OS Win2K Adv. Server installed on C:). The server also has a
> mapping to a NAS device using the latest protocols that trick the
> system into thinking the map is actually a local SCSII drive. That's
> drive X:.
> This server is used only for SQL, and contains an OLTP database that
> sees a lot of use and is pretty heavily indexed.
> I am toying with the idea of centralizing my data storage on the NAS
> (data center network segment is 1-gigabit ethernet). So I was
> thinking about putting my primary data file on the NAS (drive X:) and
> keeping all tables there, creating a secondary data file on local
> RAID-5 (drive D:) and putting all non-clustered indexes there, as well
> as keeping the tempdb there and specifying the sort in tempdb option.
> Log files would also remain on D:.
> If anyone can suggest a better scenario given the above setup - I'd
> love to hear it. Much appreciated.
> Alexey Aksyonenko|||Thanks David. Actually, they came out with this new protocol that as I
said makes the system think that the mapping is a local drive. But I
will definitely keep this in mind. Any suggestions on the actual
physical design portion, NAS aside?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!|||"Alexey Aksyonenko" <alexey.aksyonenko@.coanetwork.com> wrote in message
news:3f7469fb$0$62077$75868355@.news.frii.net...
> Thanks David. Actually, they came out with this new protocol that as I
> said makes the system think that the mapping is a local drive. But I
> will definitely keep this in mind. Any suggestions on the actual
> physical design portion, NAS aside?

Ignoring the NAS the answer is: Doesn't really matter. Since your C and D
drives are logical partitions of a single physical RAID 5 disk, it won't
make much of a difference how you lay out the files.

>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!