Tuesday, March 27, 2012
Forms authentication sample and Win XP pro /win 2k3 server
as a security extension, but since i upgraded my system to sp2 it stopped
working, besides it doent work on a win2k3 server but it works on a win2k,
the problems seems to be with ssl im using the selfssl utility to get my
cerificates as im still working on a test environment, but even if i get a
test certificate from a trusted provider it tells me it doenst trust it. the
message is the following " The underlying connection was closed: Could not
establish trust relationship with remote server. "
this happens when calling the logonuser method using soap, ive tried
changing all the adresses in the config files for https but it doesnt work.Have a look at
http://support.microsoft.com/default.aspx?scid=kb;en-us;823177
I've used this to get around the same issue in a WinForms app
--
HTH
Jasper Smith (SQL Server MVP)
http://www.sqldbatips.com
I support PASS - the definitive, global
community for SQL Server professionals -
http://www.sqlpass.org
"Rodrigo" <Rodrigo @.discussions.microsoft.com> wrote in message
news:3D0B1EF9-B419-4B14-AC19-39BEC39F8800@.microsoft.com...
>I developed an app which uses the forms authentication sample from
>microsoft
> as a security extension, but since i upgraded my system to sp2 it stopped
> working, besides it doent work on a win2k3 server but it works on a win2k,
> the problems seems to be with ssl im using the selfssl utility to get my
> cerificates as im still working on a test environment, but even if i get a
> test certificate from a trusted provider it tells me it doenst trust it.
> the
> message is the following " The underlying connection was closed: Could
> not
> establish trust relationship with remote server. "
> this happens when calling the logonuser method using soap, ive tried
> changing all the adresses in the config files for https but it doesnt
> work.
>|||also see :
http://sqljunkies.com/WebLog/roman/archive/category/370.aspx
Monday, March 26, 2012
Formatting T-SQL Performacne Boost?
I'm running into the age old problem with the battle between optimizing your code and still keeping it readable. I read somewhere that using whitespace in SQL queries is really bad as it take a lot more bandwidth and puts more stress on SQL Server parsing the SQL it is sent. Right now I have a query like so:- So the question I have is, does it really matter how the SQL query is sent? I mean, if I put it all on one line (which would kinda suck as it is harder for me to read then), would it speed up transactions significally?<?php
$selQ = 'SELECT
n.pknewsID AS newsID,
n.title,
n.full_text,
n.publish_up AS datePublished,
CONCAT(u.fname," ",u.lname) AS author,
i.loc AS img_file,
i.descr AS img_caption
FROM tblnews n
LEFT JOIN tblusers u
ON n.fkcreated_by = u.pkuserID
LEFT JOIN tblnews_images i
ON i.fknewsID = n.pknewsID
WHERE
n.pknewsID = '.$articleID.' AND
n.published = 1
LIMIT 1';
$selQ = $DB->setQuery($selQ);/**
* $DB->setQuery basically is a preg_replace function that
* removes all the tabs in the query string, and replaces them
* with a single space.
*
*/echo $selQ;
/**
* Printed out it looks like this :-
* SELECT
* n.pknewsID AS newsID
* n.title
* n.full_text
* n.publish_up AS datePublished
* CONCAT(u.fname," ",u.lname AS author,
* i.loc AS img_file,
* i.descr AS img_caption,
* FROM tblnews n
* LEFT JOIN tblusers u
* ON n.fkcreated_by = u.pkuserID
* LEFT JOIN tblnews_images i
* ON i.fknewsID = n.pknewsID
* WHERE
* n.pknewsID = 6 AND
* n.published = 1
* LIMIT 1
*
*/ Whitespace does take up more space and increase the network packet size, but I would prefer readability over trying to minimize whitespace. It does not adversely affect the parser.
?>
If you are worried about packet sizes, use stored procedures since a proc name is shorter then a query or batch. Also, use parameterized queries in general since the server can efficiently cache them and avoid compiling the query. This would be a bigger performance savings in your case above.sql
Monday, March 12, 2012
formatting a field
= (Field!Name.Value < 0, "Red", "Black") but system send this error
The color expression for the textbox 'Field name' contains an error
[BC30451] name 'Iff' is not declared.
Please let me know what can I douse =Iif(Field!Name.Value < 0, "Red", "Black")
"Yoya" wrote:
> I'm trying to format a text box color using an expression
> = (Field!Name.Value < 0, "Red", "Black") but system send this error
> The color expression for the textbox 'Field name' contains an error
> [BC30451] name 'Iff' is not declared.
> Please let me know what can I do
Friday, March 9, 2012
Formating
from a table. However as part of transferring this to a new system I need to
add leading zeroes to the front of the field.
eg 456 into 000456.
I`m sure I am having brain fade here but can`t think of the way to do this.
Any help gratefully received.SELECT RIGHT('000000' + CONVERT(varchar(20),456),6)
HTH, Jens Suessmeyer.
Friday, February 24, 2012
fORMAT eXCEPTION
I am continuously getting the error:
Exception Details: System.FormatException: Input string was not in a correct format.
Source Error:
Line 57: {
Line 58: Connection.Open() ;
Line 59: ThreadResult = ThreadCommand.ExecuteNonQuery() ;
Line 60: }
Line 61:
in the following part of the code :
protected void PostClick(object sender,EventArgs e)
{
SqlConnection Connection ;
SqlCommand ThreadCommand ;
SqlCommand GetThreadCommand ;
SqlCommand MessageCommand ;
SqlDataReader ThreadReader ;
string InsertThread,InsertMessage ;
string GetThread,Message ;
long ThreadID ;
int ThreadResult ;Connection = new SqlConnection("server=HT; Integrated Security= SSPI; Database=Forums");
Feedback.Text = "" ;InsertThread = "Insert Into Threads(ThreadName,TopicId) VALUES(@.ThreadName,@.TopicId)" ;
ThreadCommand = new SqlCommand(InsertThread, Connection) ;ThreadCommand.Parameters.Add(new SqlParameter("@.ThreadName", SqlDbType.VarChar,50)) ;
ThreadCommand.Parameters.Add(new SqlParameter("@.TopicId", System.Data.SqlDbType.Int));ThreadCommand.Parameters["@.ThreadName"].Value = ThreadText.Text ;
ThreadCommand.Parameters["@.TopicId"].Value = Request.QueryString["TopicId"] ;try
{
Connection.Open() ;
ThreadResult = ThreadCommand.ExecuteNonQuery() ;
}catch (System.Data.SqlClient.SqlException excp)
{
if (excp.Errors[0].Number == -105121349)
{
Feedback.Text = "<font color=red>*** There is already a thread with the name"+ThreadText.Text+". Please choose a different name and click Post.</font><br><br>" ;
}
else
{
Feedback.Text = "<font color=red>*** "+excp.Errors[0].Message +"<br><br>" ;
}
}
I would be very grateful for any suggestions.I expect the problem is here:
ThreadCommand.Parameters["@.TopicId"].Value = Request.QueryString["TopicId"] ;
Perhaps Request.QueryString["TopicId"] is null, or not a value that can be converted into a number? Debug the application and check this value, or alternately, do a Response.Write("TopicID: " + Request.QueryString["TopicId"] );|||Hi
Yes Mr.Douglas you are right. but the problem lies in this statement only in this page. Actually i think its in the following line in the other page :
<a href="http://links.10026.com/?link=threads.aspx?TopicId=<%=Request.QueryString["TopicId"]%>&TopicName= <%=Request.QueryString["TopicName"]%>"
Actually on printing TopicId, i noticed its '1' (with comma) instead of being just 1 due to the courtesy of above line. Can you please tell me how can i remove the comma thats being appended. Thanks a lot|||I presume when you say comma, you really mean the single quotes ' and ' and if so, change to this:
=<%=String.Trim(Request.QueryString["TopicId"],"'".ToCharArray()%
The best bet would be to determine why, on the previous page, it is putting the single quotes in.|||Yes you are right , i can use the trim method but Mr. Douglas why is the following statement attaching a comma.
<%=Request.QueryString["TopicId"]%
in
<a href="http://links.10026.com/?link=threads.aspx?TopicId=
<%=Request.QueryString["TopicId"]%>
&TopicName=<%=Request.QueryString["TopicName"]%>"
Thanks a lot and Mr. Douglas i would like you advise on a designing tool . Which one do u use since yesterday i was trying to do things with Html Table but thats a HeadAche and i can't even arrange the data the way i like.|||I have no idea what the value of Request.QueryString["TopicID"] is, but my guess is that somehow, it has the apostrophes.
I tend to use a mix of tables and Cascading Style sheets, but honestly, my page design skills are less than perfect.