I'm attempting to pass format values to a report field from a Db. I've tried
two approaches by placing the following in the format expression:
1.
=iif(Fields!type.Value="p","p",iif(Fields!type.Value=n,"n",iif(Fields!type.Value=n00,"n00",iif(Fields!type.Value=n0,"n0","n00"))))
2.
=Fields!type.Value
The first one always defaults to the false side of the equation and the
second overwrites my values with format values (n, n00, p).
How can make this work? Any help is appreciated...
DavidThe expressions should be entered into the Format property using the Property
sheet. Your data should not be overwritten.
First, you should have double quotes around the type values:
iif(Fields!type.Value="n",...). Secondly, I think you mean "N2" rather than
"N00" (number with two decimal places). Otherwise your first expression
should work if that is the logic you want.
Charles Kangai, MCT, MCDBA
"DJONES" wrote:
> I'm attempting to pass format values to a report field from a Db. I've tried
> two approaches by placing the following in the format expression:
> 1.
> =iif(Fields!type.Value="p","p",iif(Fields!type.Value=n,"n",iif(Fields!type.Value=n00,"n00",iif(Fields!type.Value=n0,"n0","n00"))))
> 2.
> =Fields!type.Value
> The first one always defaults to the false side of the equation and the
> second overwrites my values with format values (n, n00, p).
> How can make this work? Any help is appreciated...
> David|||Thanks for the reply! I've made the change...placing quotes around the value,
but the format still defaults to the falseside of the expression.
=iif(Fields!type.Value="p","p",iif(Fields!type.Value="n","n",iif(Fields!type.Value="n2","n2",iif(Fields!type.Value="n0","n0","n0"))))
any ideas?
"Charles Kangai" wrote:
> The expressions should be entered into the Format property using the Property
> sheet. Your data should not be overwritten.
> First, you should have double quotes around the type values:
> iif(Fields!type.Value="n",...). Secondly, I think you mean "N2" rather than
> "N00" (number with two decimal places). Otherwise your first expression
> should work if that is the logic you want.
> Charles Kangai, MCT, MCDBA
> "DJONES" wrote:
> > I'm attempting to pass format values to a report field from a Db. I've tried
> > two approaches by placing the following in the format expression:
> >
> > 1.
> > =iif(Fields!type.Value="p","p",iif(Fields!type.Value=n,"n",iif(Fields!type.Value=n00,"n00",iif(Fields!type.Value=n0,"n0","n00"))))
> >
> > 2.
> > =Fields!type.Value
> >
> > The first one always defaults to the false side of the equation and the
> > second overwrites my values with format values (n, n00, p).
> >
> > How can make this work? Any help is appreciated...
> >
> > David|||Did you remember that it does a case sensitive comparison? You probably
should be capitalizing your format values. The values used should definitely
be capitalized. At the very least, you should have
=iif(Fields!type.Value="p","P",iif(Fields!type.Value="n","N",iif(Fields!type.Value="n2","N2",iif(Fields!type.Value="n0","N0","N0"))))
You should additionally check the case of the database values to see whether
your comparions are working OK.
Charles Kangai, MCT, MCDBA
Charles Kangai, MCT, MCDBA
"DJONES" wrote:
> Thanks for the reply! I've made the change...placing quotes around the value,
> but the format still defaults to the falseside of the expression.
> =iif(Fields!type.Value="p","p",iif(Fields!type.Value="n","n",iif(Fields!type.Value="n2","n2",iif(Fields!type.Value="n0","n0","n0"))))
> any ideas?
> "Charles Kangai" wrote:
> > The expressions should be entered into the Format property using the Property
> > sheet. Your data should not be overwritten.
> > First, you should have double quotes around the type values:
> > iif(Fields!type.Value="n",...). Secondly, I think you mean "N2" rather than
> > "N00" (number with two decimal places). Otherwise your first expression
> > should work if that is the logic you want.
> >
> > Charles Kangai, MCT, MCDBA
> >
> > "DJONES" wrote:
> >
> > > I'm attempting to pass format values to a report field from a Db. I've tried
> > > two approaches by placing the following in the format expression:
> > >
> > > 1.
> > > =iif(Fields!type.Value="p","p",iif(Fields!type.Value=n,"n",iif(Fields!type.Value=n00,"n00",iif(Fields!type.Value=n0,"n0","n00"))))
> > >
> > > 2.
> > > =Fields!type.Value
> > >
> > > The first one always defaults to the false side of the equation and the
> > > second overwrites my values with format values (n, n00, p).
> > >
> > > How can make this work? Any help is appreciated...
> > >
> > > David|||Good point, but still no luck.
Is there a way that I can just insert my Db field value in as the format
expression?
"Charles Kangai" wrote:
> Did you remember that it does a case sensitive comparison? You probably
> should be capitalizing your format values. The values used should definitely
> be capitalized. At the very least, you should have:
> =iif(Fields!type.Value="p","P",iif(Fields!type.Value="n","N",iif(Fields!type.Value="n2","N2",iif(Fields!type.Value="n0","N0","N0"))))
> You should additionally check the case of the database values to see whether
> your comparions are working OK.
> Charles Kangai, MCT, MCDBA
>
> Charles Kangai, MCT, MCDBA
> "DJONES" wrote:
> > Thanks for the reply! I've made the change...placing quotes around the value,
> > but the format still defaults to the falseside of the expression.
> >
> > =iif(Fields!type.Value="p","p",iif(Fields!type.Value="n","n",iif(Fields!type.Value="n2","n2",iif(Fields!type.Value="n0","n0","n0"))))
> >
> > any ideas?
> >
> > "Charles Kangai" wrote:
> >
> > > The expressions should be entered into the Format property using the Property
> > > sheet. Your data should not be overwritten.
> > > First, you should have double quotes around the type values:
> > > iif(Fields!type.Value="n",...). Secondly, I think you mean "N2" rather than
> > > "N00" (number with two decimal places). Otherwise your first expression
> > > should work if that is the logic you want.
> > >
> > > Charles Kangai, MCT, MCDBA
> > >
> > > "DJONES" wrote:
> > >
> > > > I'm attempting to pass format values to a report field from a Db. I've tried
> > > > two approaches by placing the following in the format expression:
> > > >
> > > > 1.
> > > > =iif(Fields!type.Value="p","p",iif(Fields!type.Value=n,"n",iif(Fields!type.Value=n00,"n00",iif(Fields!type.Value=n0,"n0","n00"))))
> > > >
> > > > 2.
> > > > =Fields!type.Value
> > > >
> > > > The first one always defaults to the false side of the equation and the
> > > > second overwrites my values with format values (n, n00, p).
> > > >
> > > > How can make this work? Any help is appreciated...
> > > >
> > > > David|||For me, it just works doing =Fields!Type.Value. However, in my table the
formats are in capital letters.
Charles Kangai, MCT, MCDBA
"DJONES" wrote:
> Good point, but still no luck.
> Is there a way that I can just insert my Db field value in as the format
> expression?
> "Charles Kangai" wrote:
> > Did you remember that it does a case sensitive comparison? You probably
> > should be capitalizing your format values. The values used should definitely
> > be capitalized. At the very least, you should have:
> > =iif(Fields!type.Value="p","P",iif(Fields!type.Value="n","N",iif(Fields!type.Value="n2","N2",iif(Fields!type.Value="n0","N0","N0"))))
> >
> > You should additionally check the case of the database values to see whether
> > your comparions are working OK.
> >
> > Charles Kangai, MCT, MCDBA
> >
> >
> > Charles Kangai, MCT, MCDBA
> >
> > "DJONES" wrote:
> >
> > > Thanks for the reply! I've made the change...placing quotes around the value,
> > > but the format still defaults to the falseside of the expression.
> > >
> > > =iif(Fields!type.Value="p","p",iif(Fields!type.Value="n","n",iif(Fields!type.Value="n2","n2",iif(Fields!type.Value="n0","n0","n0"))))
> > >
> > > any ideas?
> > >
> > > "Charles Kangai" wrote:
> > >
> > > > The expressions should be entered into the Format property using the Property
> > > > sheet. Your data should not be overwritten.
> > > > First, you should have double quotes around the type values:
> > > > iif(Fields!type.Value="n",...). Secondly, I think you mean "N2" rather than
> > > > "N00" (number with two decimal places). Otherwise your first expression
> > > > should work if that is the logic you want.
> > > >
> > > > Charles Kangai, MCT, MCDBA
> > > >
> > > > "DJONES" wrote:
> > > >
> > > > > I'm attempting to pass format values to a report field from a Db. I've tried
> > > > > two approaches by placing the following in the format expression:
> > > > >
> > > > > 1.
> > > > > =iif(Fields!type.Value="p","p",iif(Fields!type.Value=n,"n",iif(Fields!type.Value=n00,"n00",iif(Fields!type.Value=n0,"n0","n00"))))
> > > > >
> > > > > 2.
> > > > > =Fields!type.Value
> > > > >
> > > > > The first one always defaults to the false side of the equation and the
> > > > > second overwrites my values with format values (n, n00, p).
> > > > >
> > > > > How can make this work? Any help is appreciated...
> > > > >
> > > > > David|||Thanks for helping me through this! It finally worked!
It turned out to be a field length issue on the the SQL side. A TRIM
function made it work. Ultimately, I went back to the SQL table and corrected
the field length.
David
"Charles Kangai" wrote:
> For me, it just works doing =Fields!Type.Value. However, in my table the
> formats are in capital letters.
> Charles Kangai, MCT, MCDBA
> "DJONES" wrote:
> > Good point, but still no luck.
> >
> > Is there a way that I can just insert my Db field value in as the format
> > expression?
> >
> > "Charles Kangai" wrote:
> >
> > > Did you remember that it does a case sensitive comparison? You probably
> > > should be capitalizing your format values. The values used should definitely
> > > be capitalized. At the very least, you should have:
> > > =iif(Fields!type.Value="p","P",iif(Fields!type.Value="n","N",iif(Fields!type.Value="n2","N2",iif(Fields!type.Value="n0","N0","N0"))))
> > >
> > > You should additionally check the case of the database values to see whether
> > > your comparions are working OK.
> > >
> > > Charles Kangai, MCT, MCDBA
> > >
> > >
> > > Charles Kangai, MCT, MCDBA
> > >
> > > "DJONES" wrote:
> > >
> > > > Thanks for the reply! I've made the change...placing quotes around the value,
> > > > but the format still defaults to the falseside of the expression.
> > > >
> > > > =iif(Fields!type.Value="p","p",iif(Fields!type.Value="n","n",iif(Fields!type.Value="n2","n2",iif(Fields!type.Value="n0","n0","n0"))))
> > > >
> > > > any ideas?
> > > >
> > > > "Charles Kangai" wrote:
> > > >
> > > > > The expressions should be entered into the Format property using the Property
> > > > > sheet. Your data should not be overwritten.
> > > > > First, you should have double quotes around the type values:
> > > > > iif(Fields!type.Value="n",...). Secondly, I think you mean "N2" rather than
> > > > > "N00" (number with two decimal places). Otherwise your first expression
> > > > > should work if that is the logic you want.
> > > > >
> > > > > Charles Kangai, MCT, MCDBA
> > > > >
> > > > > "DJONES" wrote:
> > > > >
> > > > > > I'm attempting to pass format values to a report field from a Db. I've tried
> > > > > > two approaches by placing the following in the format expression:
> > > > > >
> > > > > > 1.
> > > > > > =iif(Fields!type.Value="p","p",iif(Fields!type.Value=n,"n",iif(Fields!type.Value=n00,"n00",iif(Fields!type.Value=n0,"n0","n00"))))
> > > > > >
> > > > > > 2.
> > > > > > =Fields!type.Value
> > > > > >
> > > > > > The first one always defaults to the false side of the equation and the
> > > > > > second overwrites my values with format values (n, n00, p).
> > > > > >
> > > > > > How can make this work? Any help is appreciated...
> > > > > >
> > > > > > David
Showing posts with label format. Show all posts
Showing posts with label format. Show all posts
Thursday, March 29, 2012
Field Format Expression
Labels:
approaches,
attempting,
database,
expression,
field,
following,
format,
microsoft,
mysql,
oracle,
placing,
report,
server,
sql,
values
Tuesday, March 27, 2012
Field Encryption
I want to save passwords in an encrypted format in my database. Is there a b
uilt-in function of SQL Server to encrypt these, or should I use my own algo
rythm?
TIA,
Will TThere is none built-in. You can search the archives of this newsgroup for
some ideas. Also check:
www.sqlsecurity.com
Anith|||See:
http://www.microsoft.com/technet/pr...n/sp3sec03.mspx
Storing Credentials
Avoid storing credentials in any form. The best practice is to use only
Windows Authentication and never handle credentials at all. If your
application must connect with a system outside a trusted domain, however,
credential management may become necessary. In this case, the best practice
is to encrypt the credentials using the DPAPI and save them in a registry
key that uses an ACL.
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.|||If you are storing user passwords for your application and need a small leve
l of encryption to use. Try the undocumented
PWDENCRYPT:
String function used to encrypt a string using SQL Server's password encrypt
ion algorithm.
SELECT PWDENCRYPT('string')
and
PWDCOMPARE
String function used to compare an unencrypted string to the value returned
by the PWDENCRYPT function.
SELECT CASE ISNULL(PWDCOMPARE ('sa',(SELECT password FROM master.dbo.syslogi
ns WHERE name = 'sa')),0)
WHEN 0 THEN 'Not the same'
WHEN 1 THEN 'Password the same as the login'
END
No real decrypt function available.
These two encryption functions are what SQL Server uses to stored its own pa
sswords, are not extremely strong. Commerical products are available that ar
e much stronger.
Randy
www.Database-Security.Info|||To add to Randy's response, one shouldn't use undocumented features in
production code. These may be changed in future SQL Server versions or
service packs and break your application.
Hope this helps.
Dan Guzman
SQL Server MVP
"Will T" <anonymous@.discussions.microsoft.com> wrote in message
news:158D0D8C-1B5B-4633-AA05-0FAAC0352826@.microsoft.com...
> I want to save passwords in an encrypted format in my database. Is there a
built-in function of SQL Server to encrypt these, or should I use my own
algorythm?
> TIA,
> Will T|||pls send reply sooooooooooooon
****************************************
******************************
Sent via Fuzzy Software @. http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET
resources...sql
uilt-in function of SQL Server to encrypt these, or should I use my own algo
rythm?
TIA,
Will TThere is none built-in. You can search the archives of this newsgroup for
some ideas. Also check:
www.sqlsecurity.com
Anith|||See:
http://www.microsoft.com/technet/pr...n/sp3sec03.mspx
Storing Credentials
Avoid storing credentials in any form. The best practice is to use only
Windows Authentication and never handle credentials at all. If your
application must connect with a system outside a trusted domain, however,
credential management may become necessary. In this case, the best practice
is to encrypt the credentials using the DPAPI and save them in a registry
key that uses an ACL.
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.|||If you are storing user passwords for your application and need a small leve
l of encryption to use. Try the undocumented
PWDENCRYPT:
String function used to encrypt a string using SQL Server's password encrypt
ion algorithm.
SELECT PWDENCRYPT('string')
and
PWDCOMPARE
String function used to compare an unencrypted string to the value returned
by the PWDENCRYPT function.
SELECT CASE ISNULL(PWDCOMPARE ('sa',(SELECT password FROM master.dbo.syslogi
ns WHERE name = 'sa')),0)
WHEN 0 THEN 'Not the same'
WHEN 1 THEN 'Password the same as the login'
END
No real decrypt function available.
These two encryption functions are what SQL Server uses to stored its own pa
sswords, are not extremely strong. Commerical products are available that ar
e much stronger.
Randy
www.Database-Security.Info|||To add to Randy's response, one shouldn't use undocumented features in
production code. These may be changed in future SQL Server versions or
service packs and break your application.
Hope this helps.
Dan Guzman
SQL Server MVP
"Will T" <anonymous@.discussions.microsoft.com> wrote in message
news:158D0D8C-1B5B-4633-AA05-0FAAC0352826@.microsoft.com...
> I want to save passwords in an encrypted format in my database. Is there a
built-in function of SQL Server to encrypt these, or should I use my own
algorythm?
> TIA,
> Will T|||pls send reply sooooooooooooon
****************************************
******************************
Sent via Fuzzy Software @. http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET
resources...sql
Monday, March 26, 2012
Feeding "0"s in a string
hi,
I have this command in Vb that feeds "0" in a string, and I need it to work in a SP.
ProductNum = format(ProductNum, String(nBarCodelength, "0"))
if ProductNum = "12345" and nBarCodelength = 10
the result of the above will be "0000012345" (the numbers were fed with "0").
placing that command in a SP raises me an error.
What replaces 'format' and 'String' commands in TSQL?
ThanksTry:
declare @.string varchar(20)
select @.string = '12345'
select stuff(@.string,1,0,replicate('0',10 - len(@.string)))
or
declare @.string varchar(20)
select @.string = '12345'
select replicate('0',10 - len(@.string)) + @.string|||Originally posted by rnealejr
Try:
declare @.string varchar(20)
select @.string = '12345'
select stuff(@.string,1,0,replicate('0',10 - len(@.string)))
or
declare @.string varchar(20)
select @.string = '12345'
select replicate('0',10 - len(@.string)) + @.string
I will try it.
Many thanks mate.....
I have this command in Vb that feeds "0" in a string, and I need it to work in a SP.
ProductNum = format(ProductNum, String(nBarCodelength, "0"))
if ProductNum = "12345" and nBarCodelength = 10
the result of the above will be "0000012345" (the numbers were fed with "0").
placing that command in a SP raises me an error.
What replaces 'format' and 'String' commands in TSQL?
ThanksTry:
declare @.string varchar(20)
select @.string = '12345'
select stuff(@.string,1,0,replicate('0',10 - len(@.string)))
or
declare @.string varchar(20)
select @.string = '12345'
select replicate('0',10 - len(@.string)) + @.string|||Originally posted by rnealejr
Try:
declare @.string varchar(20)
select @.string = '12345'
select stuff(@.string,1,0,replicate('0',10 - len(@.string)))
or
declare @.string varchar(20)
select @.string = '12345'
select replicate('0',10 - len(@.string)) + @.string
I will try it.
Many thanks mate.....
Friday, March 9, 2012
Faster Printouts In Dotmatrix
Is it possible to format the crystal reports to take faster printouts in dotmatrix, if yes then how?
Thanks
krishnanblrYes, you can get speed of Dos mode printing.
Install a Dot matrix printer driver (Eg.Epson-Ex-1000)
In the report, set font of ALL columns to Roman 12/10 cpi or Sanserif 12/10 cpi or Draft 10 cpi or Draft 12 cpi.
In the printer setup dialog, don't forget to select
Device Options - Print Quality - Draft.
-Madhu :wave:|||Thanks for the reply, i will try and get back on this. thanks again :)
Thanks
krishnanblrYes, you can get speed of Dos mode printing.
Install a Dot matrix printer driver (Eg.Epson-Ex-1000)
In the report, set font of ALL columns to Roman 12/10 cpi or Sanserif 12/10 cpi or Draft 10 cpi or Draft 12 cpi.
In the printer setup dialog, don't forget to select
Device Options - Print Quality - Draft.
-Madhu :wave:|||Thanks for the reply, i will try and get back on this. thanks again :)
Subscribe to:
Posts (Atom)