Showing posts with label configure. Show all posts
Showing posts with label configure. Show all posts

Friday, March 23, 2012

Is it possible to dispaly all columns for a record in a dropdownlist

Say a record has four columns in { Emp#, firstName, secondName, thirdName, spouseName }.

Now if you configure a sql datasource for a dropdownlist to return all columns, only Emp# will be displayed in the dropdownlist, the other columns wont be listed.

Is there a way to list the values of all columns in the dropdownlist using the sql datasource or in ADO.net code.

Thanks.

You have 5 columns there... but I think I see what you mean.

Anyway, the easiest way to do this is on your SQL.

"SELECT Emp#, firstname + ' ' + secondname + ' ' + thirdname + ' ' + spouseName AS TheName FROM table". Then set Emp# as the DataValueField value and TheName as the DataTextField value

|||

Mikesdotnetting:

"SELECT Emp#, firstname + ' ' + secondname + ' ' + thirdname + ' ' + spouseName AS TheName FROM table". Then set Emp# as the DataValueField value and TheName as the DataTextField value

But this would be listed as one dropdownlist value. I want each column to be listed in the dropdownlist as a new value. Since they are five columns, then i want them as five dropdownlist values.|||

Nope - sorry. Don't follow you. Do you mean you want them like this:

<item>firstname1</item>
<item>secondanme1</item>
<item>thirdname1</item>
<item>spousename1</item>
<item>firstname2</item>
<item>secondname2</item>

etc or do you mean like this:http://www.codeproject.com/aspnet/MultiColDdList.asp ?

|||

Mikesdotnetting:

Do you mean you want them like this:

<item>firstname1</item>
<item>secondanme1</item>
<item>thirdname1</item>
<item>spousename1</item>
<item>firstname2</item>
<item>secondname2</item>

Exactly.

But we would have to leave out firstname2 and secondname2. It would be like so

EMPLOYEE_1

<item>firstname1</item>
<item>secondanme1</item>
<item>thirdname1</item>
<item>spousename1</item>

EMPLOYEE_2

<item>firstname2</item>
<item>secondanme2</item>
<item>thirdname2</item>
<item>spousename2</item>

EMPLOYEE_3

<item>firstname3</item>
<item>secondanme3</item>
<item>thirdname3</item>
<item>spousename3</item>

Now notice that only one employee firstbname, secondname, thirdname and spousename would be listed in droopdownlist at a time and that is why i said we will leave out we would have to leave out firstname2 and secondname2 in your quoted example code above. But infact you have got the exact logic i want.

|||

Ok. You can get the record for each employee in your code-behind and loop through the fields in the DataReader, appending items to your dropdownlist as you go.

[Not complete or tested - just intended to convey the general idea]

while(rdr.Read())
{
for(int i = 0;i < rdr.FieldCount;i++)
{
MyDropdownlist.Items.Add(rdr[i].ToString());
}
}

|||

SELECT FirstName AS Value FROM MyTable WHEREEmpID=@.EmpID

UNION

SELECT SecondName AS Value FROM MyTable WHEREEmpID=@.EmpID

UNION

SELECT SpouseName AS Value FROM MyTable WHEREEmpID=@.EmpID

|||

Almost all the replies so far work in regard to displaying the values in the dropdownlist but not in retaining the selectedindex on page postback.

Now i have discovered why the selectedindex is always being read as 0 but i do not know how to resolve the problem, but atleast i now know why.

This behavour is being caused by the presence of a multivew and its child views. I say so because if i move my databound controls outside of the multiview views, every thing runs great, when i put them back in the view, selected index is always 0. I have tested and confirmed that this is the cause. I however have no idea how to fix this even after googling for some days.

As more proof, if i go to my page's markup and look at multiview tag, it is underlined in red meaning some error and in the tooltip, the error says

"Validation(ASP.NET): Text can not be allowed between opening and closing tags of element multiview" .

Using a multiview and its child views made my application look smart and easy to navigate, but now here is the pain at last.

sql

Wednesday, March 7, 2012

Friday, February 24, 2012

Is DTC required in a SQL 2000/Windows 2003 cluster ?

Hi,
If the SQL environment is not going to use distributed transactions, is it
still necessary to configure a DTC resource on the cluster ?
Thanks
In theory, you can run SQL 2000 clustered without DTC. In practice, it can
limit functionality. I generally configure a DTC resource, just to simplify
installation and maintenance.
Geoff N. Hiten
Senior Database Administrator
Microsoft SQL Server MVP
"SteveO" <SteveO@.discussions.microsoft.com> wrote in message
news:332351AB-0806-4F9A-94DF-C5F929F5B7D0@.microsoft.com...
> Hi,
> If the SQL environment is not going to use distributed transactions, is it
> still necessary to configure a DTC resource on the cluster ?
> Thanks
|||Yes. You will always configured DTC into the cluster. There are other
services which will use it.
Mike
http://www.solidqualitylearning.com
Disclaimer: This communication is an original work and represents my sole
views on the subject. It does not represent the views of any other person
or entity either by inference or direct reference.
"SteveO" <SteveO@.discussions.microsoft.com> wrote in message
news:332351AB-0806-4F9A-94DF-C5F929F5B7D0@.microsoft.com...
> Hi,
> If the SQL environment is not going to use distributed transactions, is it
> still necessary to configure a DTC resource on the cluster ?
> Thanks
|||I hate to nitpick. But technically, you don't have to if you don't need it.
Linchi
"Michael Hotek" <mike@.solidqualitylearning.com> wrote in message
news:%23YUT2d2IGHA.2912@.tk2msftngp13.phx.gbl...
> Yes. You will always configured DTC into the cluster. There are other
> services which will use it.
> --
> Mike
> http://www.solidqualitylearning.com
> Disclaimer: This communication is an original work and represents my sole
> views on the subject. It does not represent the views of any other person
> or entity either by inference or direct reference.
> "SteveO" <SteveO@.discussions.microsoft.com> wrote in message
> news:332351AB-0806-4F9A-94DF-C5F929F5B7D0@.microsoft.com...
>
|||Well, you'd have to take that up with the failover clustering team. It is
their explicit recommendation for ALL clusters that you will install a
failover cluster instance in.
Not having it there is going to cause several errors during the upgrade as
well as throwing additional errors during a fresh install. I haven't tested
enough permutations to say whether it is needed or not, so at this point, I
tend to trust the people who have spent thousands of hours testing hundreds
of different configurations. They know the code a lot better than me since
they wrote it. If that's the recommendation, I'm sticking into in this
case, because I have no way of proving that it shouldn't be followed.
Mike
http://www.solidqualitylearning.com
Disclaimer: This communication is an original work and represents my sole
views on the subject. It does not represent the views of any other person
or entity either by inference or direct reference.
"Linchi Shea" <linchi_shea@.NOSPAMml.om> wrote in message
news:%23Dc$G%238IGHA.2064@.TK2MSFTNGP09.phx.gbl...
>I hate to nitpick. But technically, you don't have to if you don't need it.
> Linchi
> "Michael Hotek" <mike@.solidqualitylearning.com> wrote in message
> news:%23YUT2d2IGHA.2912@.tk2msftngp13.phx.gbl...
>
|||I have 15 SQL Clusters in Production without MSDTC in the cluster, the local
service is disabled. No issues. Our application simply does not use it!
Cheers,
Rod
MVP - Windows Server - Clustering
http://www.nw-america.com - Clustering Website
http://www.msmvps.com/clustering - Blog
http://www.clusterhelp.com - Cluster Training
"Michael Hotek" <mike@.solidqualitylearning.com> wrote in message
news:uuCH0K9IGHA.1132@.TK2MSFTNGP10.phx.gbl...
> Well, you'd have to take that up with the failover clustering team. It is
> their explicit recommendation for ALL clusters that you will install a
> failover cluster instance in.
> Not having it there is going to cause several errors during the upgrade as
> well as throwing additional errors during a fresh install. I haven't
> tested enough permutations to say whether it is needed or not, so at this
> point, I tend to trust the people who have spent thousands of hours
> testing hundreds of different configurations. They know the code a lot
> better than me since they wrote it. If that's the recommendation, I'm
> sticking into in this case, because I have no way of proving that it
> shouldn't be followed.
> --
> Mike
> http://www.solidqualitylearning.com
> Disclaimer: This communication is an original work and represents my sole
> views on the subject. It does not represent the views of any other person
> or entity either by inference or direct reference.
>
> "Linchi Shea" <linchi_shea@.NOSPAMml.om> wrote in message
> news:%23Dc$G%238IGHA.2064@.TK2MSFTNGP09.phx.gbl...
>
>