Friday, March 30, 2012
Problems with values display as currency
has anybody got a report with values formatted as currency and could export
it to pdf without loosing the currency-formatting?
My currency-values are in Euro. Do i have to put some language-parametes in
the URL?
regards
Frank
www.xax.deAdobe 5.00 and 5.05 do not render symbols (e.g. Euro symbol) correctly when
the Arial font is used. Which version are you using? Did you try other fonts
(e.g. Tahoma)?
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Frank Matthiesen" <fm@.xax.de> wrote in message
news:34mtrsF4avhu6U1@.individual.net...
> Hi NG,
> has anybody got a report with values formatted as currency and could
export
> it to pdf without loosing the currency-formatting?
> My currency-values are in Euro. Do i have to put some language-parametes
in
> the URL?
> regards
> Frank
> www.xax.de
>
>|||"Robert Bruckner [MSFT]" <robruc@.online.microsoft.com> schrieb im
Newsbeitrag news:eEvOCqZ%23EHA.3592@.TK2MSFTNGP09.phx.gbl...
> Adobe 5.00 and 5.05 do not render symbols (e.g. Euro symbol) correctly
> when
> the Arial font is used. Which version are you using? Did you try other
> fonts
> (e.g. Tahoma)?
Got the wrong acrobat-version (5.0)
After an update everything wirks fine.
thx
frank
www.xax.desql
Wednesday, March 28, 2012
Problems with SqlDataSource Parameters
Hello!
I am pulling my hair out over this latest problem. I'm trying to do a simple SQL SELECT statement by taking values from textboxes and inserting them into the WHERE part of the statement. I'm using MySQL and have to use ? prefix for all inserts, that I have working by the way. Now for some reason I cannot get the values from the text boxes to replace the prefixes! Here is my code:
private void submitLogin(object source, EventArgs e) {if (isPassword(password.Text.ToString()) && isEmail(username.Text.ToString())) { ValidateCustomer.SelectParameters["c_email"].DefaultValue ="fish"; ValidateCustomer.SelectParameters["c_password"].DefaultValue ="cakes"; test_label.Text = ValidateCustomer.SelectCommand.ToString(); }else { test_label.Text ="Username or Password Incorrect"; }} <asp:SqlDataSource runat="server" ID="ValidateCustomer" ProviderName="System.Data.Odbc" ConnectionString ="<%$ connectionStrings:MySQLDatabase%>" SelectCommand ="SELECT * FROM customer_details WHERE (Customer_Email = ? AND Customer_Password = ?)"> <selectparameters> <asp:parameter name="c_email" type="String" /> <asp:parameter name="c_password" type="String" /> </selectparameters></asp:SqlDataSource>
I have omitted obvious code. The test label, when updated, shows the SQL statement but with the ?. I also use controlparameters that took the values directly from the textboxes but again this did not work. I'm really stuck with this one. Your help is much needed!
Cheers
Dan
i have to be honest with you i never write my sql in the little wizard because it exposes that to the user, make a stored procedure, moreover i dont know what (?) do. When you use a stored procedure the sqldatasource takes care of all the params for you
|||MySQL supports both parameter syntaxes (@.name and ?) if you use the managed .NET connector (I believe 5.1.4 is the latest version). You can continue to use the ? syntax, but I would recommend against it. ? parameters depend upon position and order of declaration and use and don't allow reuse of a single parameter within a query.
That said, pulling the SelectCommand should never show the query with the parameters "replaced". Parameterized queries are not simple search/replaces, and even if they were, it should pull back the value you set the SelectCommand to, not the interally post-replaced value.
|||Cheers for the replies folks!
I'm actually only doing this for a University Project so it doesn't really need to be water tight, but I get you point.
So does this mean then that I shouldn't actually see the values I think I should be seeing? Then the only way I know it works is if the select statement returns any values?
|||You can put a breakpoint on the SqlDatasource_Selecting event, and look at the e.Command.Parameters collection if you want.
|||So when I have the default values of the parameters set does the dataview update itself? If not then how do I enforce an update? At the moment it looks like it doesn't as I have the default values changed and when I try to return rows from the dataview I get none.
Cheers
Dan
|||In VB this is how you would do it:
private void submitLogin(object source, EventArgs e) {
if (isPassword(password.Text.ToString()) && isEmail(username.Text.ToString()))
{
dim conn as new SqlConnection(System.Configuration.ConfigurationManager("MySQLDatabase").ToString)
dim cmd as new SqlCommand("SELECT COUNT(*) FROM customer_details WHERE (Customer_Email = @.email AND Customer_Password = @.password)",conn)
cmd.Parameters.Add("@.email",SqlDbType.NVarchar).Value=username.Text
cmd.Parameters.Add("@.password",SqlDbType.NVarchar).value=password.Text
conn.open
text_label.Text=cmd.ExecuteScalar.ToString
conn.close
}
else {
test_label.Text ="Username or Password Incorrect";
}
}
test_label should then either be a "0" if no records were found, or >=1 if 1 or more customer_detail records had a username/password that matched what was typed.
Running that through a VB -> C# converter gives:
SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager("MySQLDatabase").ToString);
SqlCommand cmd = new SqlCommand("SELECT COUNT(*) FROM customer_details WHERE (Customer_Email = @.email AND Customer_Password = @.password)", conn);
cmd.Parameters.Add("@.email", SqlDbType.NVarchar).Value = username.Text;
cmd.Parameters.Add("@.password", SqlDbType.NVarchar).value = password.Text;
conn.open();
text_label.Text = cmd.ExecuteScalar.ToString;
conn.close();
Thanks for the reply.
I'm using Web Controls so this solution would mean changing a lot of code. Is there anyway I could accomplish this but within the limits of my SqlDataSource and DataView controls? When I try to do the SqlDataSource.Select() method I get errors.
Cheers
Dan
sqlMonday, March 26, 2012
Problems with SP and NULL values.
I have two servers, one with SQL 7.0 SP4 (Production server) and the
development server with SQL 2000 SP3.
One developer tells me that in the development server the store procedures
he creates permits the NULL output. On the production server, he says that
the SP migrated, does not permit a NULL output.
Is this true? how can i check this?
Thanks all.Output *parameters* may be NULL. *RETURN values* must be a non-NULL integer,
although this is handled as a warning rather than an error in 2000. May have
been different in 7.0, I don't recall. Don't try to return a NULL RETURN
value.
You use SQL2000 as a dev box for a 7.0 production server?! Good luck! ;-)
David Portas
SQL Server MVP
--|||Thanks David, the developer has corrected the scripts and now all is working
fine.
I dont unterstand why the developers have migrated to SQL 2000 without
permission, i am new to the company, so my next task will be migrate the SQl
7.
Thanks again.
Wednesday, March 21, 2012
Problems with null values
I have a table with the following fields:
patchbayLineout,summary,lineBoxName,effectid,compr essorID,preAmpID,synthID,mixingConsoleID,drumMachi neID.
On the same row as PatchBayLineOut, the part connected there should have its name showing. In the table, the ID is present. For instance, a LineOut that has a Linebox connected contains LineBoxID, and NULL in all the other places.
The output I want is this:
1, Summary text, LB.Name, null, null, null, null, null, null
2, Summary text, null, E.Name, null, null, null, null, null
3, Summary text, null, null, C.Name, null, null, null, null
4, Summary text, null, null, null, PA.Name, null, null, null
Can anyone help me?I think you want to perform a lot of outer joins like this:
select t.id, t.summary, lb.name, e.name, c.name, pa.name, ...
from t
left outer join lb on lb.id = t.lb_id
left outer join e on e.id = t.e_id
... etc.sql
Problems with null values
Unfortunately, when I go from rst to XML, any null values are chopped off and don't appear in the XML tree. This causes problems in further developments.
It would appear that the easiest way to fix the problem is to guarrantee that there are no nulls in the output data.
I've tried ' ' + tbl.column as NewCol but when tbl.column is null, the result is null also.
suggestions?
For the record, for some damn reason the FOR XML RAW command does not work on my SQL. Don't know why, but I'm trying to find a work around.select coalesce(tbl.column,'') as newcol
replaces null with zero-length string
use 0 for numeric fields, i guess
rudy|||u can check the null value while retreiving the value from a recordset to a variable by iif(isnull(rsAdo("column")),"",rsAdo("column"))|||A variation of r937's answer:
SELECT IsNull(Field, 0) AS Field1
or
SELECT IsNull(Field, 'unknown') AS Field1
Saturday, February 25, 2012
problems with < or > string values
I have a query that is trying to find all of the names that fall between a low and high value. I'm using CHR(10) for the low value and this seems to work, but using a '{' for the high value does not. I chose '{' because it is one higher then 'z' in the ASCII charts. So the query looks something like this.
SELECT * FROM People where LastName > @.LastNameLow and LastName < @.LastNameHigh
The parameter values are built in .Net code and passed to the stored proceedure. @.LastNameLow is a string of CHR(10) values whose length is equal to the column length. @.LastNameHigh is a string of '{' characters whose length is equal to the column length.
When I run this query, I get no rows returned. However if I change the '{' character to 'z' character, it does return rows. However I don't want to use 'z' because the query is <, not <=. And before you ask, no I cant change it. I've tried '|', '}' and '~', all of which are valid ASCII values above 'z' and valid printable characters, but none of them seem to work in this case.
Any help would be appreciated.
Bill
you want a default LOWEST and HIGHEST value when user does not specify any value is it ?why not pass in NULL value to @.LastNameLow or @.LastName High if user does not specify any Low or High value
SELECT *
FROM People
WHERE LastName >= coalesce(@.LastNameLow , LastName)
AND LastName <= coalesce(@.LastNameHigh, LastName)|||
A variation on K H Tan's solution (passing in Null when there is no upper or lower limit) is:
SELECT *
FROM People
WHERE ((LastName > @.LastNameLow) OR (@.LastNameLow IS NULL)) AND
((LastName < @.LastNameHigh) OR (@.LastNameHigh IS NULL))
Or if you have to take a string value instead then assuming you use say '@.#@.' as the no limit token then you can use the query:
SELECT *
FROM People
WHERE ((LastName > @.LastNameLow) OR (@.LastNameLow = '@.#@.')) AND
((LastName < @.LastNameHigh) OR (@.LastNameHigh = '@.#@.'))
You can use any token that would not be provided as a legitimate range value. I hope this helps.
|||Not exactly. This kind of query is essentially being used as a LIKE statement. For instance if the user wants to search last names and enters 'SM' for the value, the parameters would code up to be 'SM'+chr(10)+chr(10)...+chr(10) for @.LastNAme Low and 'SM{{{{...{{{' for @.LastNameHigh. the intent is to return all last names that begin with 'SM'. Like I've said though, I don't really have control over the query and can't change it to a LIKE, so I'm trying to find values that will work. If @.LastNAmeHigh is 'SM{{{{...{{{' we get 0 rows returned, but if @.LastNameHigh is 'SMzzzzzz...zzzz' it does get some rows.
I know this must have something to do with the coallation and sort order set on the sql server. As near as I can tell we are using the default coallation which is Latin 1252 with sort order 52. The LAtin 1252 code page seems to match a traditional ASCII chart, but I have no idea what sort order 52 means or how to tell specifically how it is sorting.
Bill