Showing posts with label form. Show all posts
Showing posts with label form. Show all posts

Wednesday, March 28, 2012

Predefined reports for Perfmon data

I have perfmon data collected in a sql database and now i would like to
display the data captured in the form of report.. But I dont really know how
to go about it ? Is there a pack or set of reports that are out there that I
could use and just plug it to the perfmon collection database ?
Thankshi there
you may want to check out this link - scroll down the page - hopefully
something may help you.
http://sqlblog.com/blogs/andrew_kelly/
Jewel
"Hassan" wrote:
> I have perfmon data collected in a sql database and now i would like to
> display the data captured in the form of report.. But I dont really know how
> to go about it ? Is there a pack or set of reports that are out there that I
> could use and just plug it to the perfmon collection database ?
> Thanks
>

Friday, March 23, 2012

Pound Sign Problem

Hi

I have come across a bit of problem with my Web Form. I have standard textbox which inserts a value into a SQL 2000 database. However if I put a pound sign anywhere inside the text box and do the insert it disappears when I try and reshow the value.

I have checked the database field to see if it has been inputted but its no where to be seen.

So what has happened to my pound sign? any ideas?

I am using VS.Net 2003.

Thanks in advanceThat is strange. SQL 2000 does not reject the pound sign. Neither does the text box control. I did several tests, cannot seem to produce your problem. Do you do any kind of massage to your input in your code before it is insert into the database table?

Please post your code.|||Hiya

Sorry for the delay in getting back to you, please find below my code. This problem really does have me miffed

Cmd As New SqlCommand

Conn.Open()
With objCmd
.Connection = Conn
.CommandType = CommandType.Text
.CommandText = "INSERT INTO PhoneList (FirstName, Surname) " & _
" VALUES (@.FirstName, @.Surname)"

.Parameters.Clear()
.Parameters.Add("@.FirstName", SqlDbType.VarChar).Value = txtFirstName.Text
.Parameters.Add("@.Surname", SqlDbType.VarChar).Value = txtSurname.Text
.ExecuteNonQuery()
End With
Conn.Close()

Field types in theSQL Server 2000 DB are Varchar's. Just thought could this be one of the rasons for the roblem

Thanks in advance|||I have seen this problem before and I think the DataType on the column needs to beText to store ASCII characters.|||Hi PD

I have changed the data type to Text in my SQL DB but I still get the same problem

It just seems really odd, every other character works including !"$%^&*()

but the £ just does not get stored|||I was sleeping when I read your post, I thought you meant the # sign.

Themonetary data types MONEY and SMALLMONEY can accept many national currency symbols like the British pound, the Euro and others.|||How about if you use NVarChar instead?
Although you shouldn't have to go unicode in order to save the pound sign...

Regards
Fredrik|||Hi Fredrik

I have tried changing it to NvarChar and still didnt have any joy. I have even searched around on teh web and cant seem to find anybody else who has had that problem

Just wondering can anybody else replicate this problem there end?

I dont seem to have any hair left..... i think ive pulled it all out|||OK the only way I can seem to get round the problem is by inputting the HTML equvilant of a £ sign which is £

So when this is rendered it appears as a £

But im sure this cant be a solution.... can it?

I even tried to set validateRequest="false", but did not have any joy|||I am sorry. I thought it was # as well.
I did a test. Cannot re-produce the problem. I am using Varchar for the data field.

Did you try to debug and see whether the pound value was passed in correctly?|||Here is my test code in C#. I just have a textbox at the front end.


conn.Open ();
string strInsert = "Insert Into Chun (Test) Values (@.chun)";
SqlCommand cmd = new SqlCommand (strInsert, conn);
SqlParameter p = new SqlParameter("@.chun",SqlDbType.VarChar,50);
p.Value = txtPound.Text;
p.Direction = ParameterDirection.Input;
cmd.Parameters.Add (p);
cmd.ExecuteNonQuery ();
conn.Close ();

Here is the value I entered in the text box:

£5432

The value is stored and retrieve displayed as it is.|||I have a similar issue when I pass the # as part of a query string! It chops everything off after the pound sign!|||I did eventually manage to solve my pound sign problem, it was a problem with the globalization setting in the web.config.

Try reading the below article and see if it helps

http://www.howtodothings.com/showarticle.asp?article=755

Good luck

Wednesday, March 21, 2012

Postcode Formula Error

Hi,

I want to return everything up to and including, the first letter of the second half of UK postcodes. They take the form "BN2 6DE" or "DN28 7YT". As you can see the first section can be either three or four characters. What I am looking for is a formula that locates the space in the string and then returns the adjacent character and everything preceding and including the space.

The Postcodes are stored in {T_OrderHeader.ShipPostcode}.

I had tried removing the space and returning a set number of digits but this still leaves me with extra data as the first section can be either 3 or four characters.

Please can anyone help? You will be saving me a lot of time manually adjusting entries in Excel!Try this:

Left({T_OrderHeader.ShipPostcode},InStr({T_OrderHeader.ShipPostcode}," ")+1)|||This worked a treat ! thanks very much!

Postal code search and LIKE statement

I'm trying to create a form that allows someone to find anaddress from a postal code search in the database. My query works exactly as I’dlike in query builder using the following select:

Select [FIELD_LIST] from addresses WHETE POSTCODE LIKE ‘%’+@.POSTCODE+’%’

I then pass the user entered post code to the select statementwhich is executed. However, I’m getting some odd behaviour. Assuming there isan address in the database with the post code “LS11 0ES”...

If I search for LS11, nothing is returned;

If I search for LS11%, nothing is returned;

If I search for %LS11%, nothing is returned;

If I search for %LS11%%, the data is returned.

If I search for %LS%1%%, the data is returned (as is LS210ES etc. etc.).

However, I want the user to be able to enter shorter searchstrings and it to pull all the data back out, so they can enter a substringsuch as LS and it will pull out all the data without the users needing to enterthe full pattern of % symbols.

If I go into query builder (in visual web developer) andenter just “LS” it works as I’d want, but not when pulled from a web page.

Any ideas?

Thanks

Look for other causes. I'm guessing somewhere in your code, you are removing the last % in postcode either before assigning it to the parameter, or modifying it during the selecting event.|||Thanks.At the moment I have a details view bound to an objectsource which in turn is bound to the above query and the parameter taken in from the text box’s .text property which the user types in.How can I trace where its failing?Thanks|||

A) response.write all your variables

or

B) Use a debugger like visual studio

sql

Post to a DB

Alright so here is what I am trying to do.

I have a form that someone fills out it has a text box as title, and a drop down box that is a category, and then a text area that is for their explanation.

On the back end I am using a stored procedure called sp_store_bkm. When I execute this it works just fine and puts the data that I put in it into the to table below is the Stored procedure code:

ALTER PROCEDURE sp_store_bkm
@.oID nvarchar OUTPUT,
@.oTitle nvarchar(50),
@.oCategory nvarchar(50),
@.obkmtext nvarchar(MAX)

AS BEGIN

INSERT INTO tbl_bkms(Title, Category, bkmtext)
VALUES(@.oTitle, @.oCategory, @.obkmtext)
Set @.oID= SCOPE_IDENTITY()
END

Now on my front end it comes up with an error in the lower left (erros on page). When I click on the error for details it seems like it is coming fromt he connection string. I cant find anything wrong with the connection string. Below is my code for the aspx page.

<%@. Page Language="VB" MasterPageFile="~/MasterPage.master" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">


<script>

function Submit2_onclick() {

Dim Connection As SqlConnection = "server=localhost;Database=BKM.mdf;integrated security=SSPI;"
connection.Open()
Try
Dim command As SqlCommand = New SqlCommand("sp_store_bkm", connection)

command.CommandType = CommandType.StoredProcedure
Dim oID As New SqlParameter("@.oID", SqlDbType.Int)
oID.Direction = ParameterDirection.Output

command.Parameters.Add(oID)
command.Parameters.Add("@.oTitle", title.text)
command.Parameters.Add("@.oCategory", category.text)
command.Parameters.Add("@.obkmtext", bkmtext.text)
command.ExecuteNonQuery()

Dim sOrderID As String = oID.Value }
</script>

<form method="post">
<table cellpadding="10" style="width: 100%">
<tr>
<td style="width: 100px">
<span style="font-size: 10pt; font-family: Verdana">
Login ID:
<br />
</span>
<asp:LoginName ID="LoginName1" runat="server" Font-Names="Verdana" Font-Size="10pt" ForeColor="Red" />
<span style="font-size: 10pt; font-family: Verdana">
<br />
<br />
Title:<br />
</span>
<input id="title" style="width: 374px" type="text" /><br />
<br />
<span style="font-size: 10pt; font-family: Verdana">
Category:<br />
</span>
<select id="Category" name="D1" size="1" language="javascript" onclick="return Select1_onclick()">
<option selected="selected">Office Applications</option>
<option>VPN</option>
<option>WLAN</option>
</select>

<br />
<span style="font-size: 10pt; font-family: Verdana">
<br />
Your BKM<br />
</span>
<textarea id="bkmtext" style="width: 378px; height: 196px"></textarea><br />
<br />
<input id="Reset1" type="reset" value="reset" />
<input id="Submit2" type="submit" value="submit" language="javascript" onclick="return Submit2_onclick()" /></td>
</tr>
</table>
</form>
</asp:Content>

Please help.

What,exactly is the error message?|||

Well I am closer now. I dont get errors on the page, but nothing gets posted into the DB. If there is an easier way to do this let me know. This is the way I was told to do it.

below is the aspx page, the stored procedure is still the same.

<%@. Page Language="VB" MasterPageFile="~/MasterPage.master" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">


<script language=vbscript type="text/vb">

function Submit2_onclick()

Dim Connection;As SqlConnection = 'Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\BKM.mdf;Integrated Security=True;User Instance=True'
connection.Open()
Try
Dim command As SqlCommand = New SqlCommand("sp_store_bkm", connection)

command.CommandType = CommandType.StoredProcedure
Dim oID As New SqlParameter("@.oID", SqlDbType.Int)
oID.Direction = ParameterDirection.Output

command.Parameters.Add(oID)
command.Parameters.Add("@.oTitle", title.text)
command.Parameters.Add("@.oCategory", category.text)
command.Parameters.Add("@.obkmtext", bkmtext.text)
command.ExecuteNonQuery()

Dim sOrderID As String = oID.Value
End function
</script>

<form method="post">
<table cellpadding="10" style="width: 100%">
<tr>
<td style="width: 100px">
<span style="font-size: 10pt; font-family: Verdana">
Login ID:
<br />
</span>
<asp:LoginName ID="LoginName1" runat="server" Font-Names="Verdana" Font-Size="10pt" ForeColor="Red" />
<span style="font-size: 10pt; font-family: Verdana">
<br />
<br />
Title:<br />
</span>
<input id="title" type="text" /><br />
<br />
<span style="font-size: 10pt; font-family: Verdana">
Category:<br />
</span> <select id="category">

<option selected="selected"></option>
<option>VPN</option>
</select>

<br />
<span style="font-size: 10pt; font-family: Verdana">
<br />
Your BKM<br />
</span>
<textarea id="bkmtext" style="width: 589px; height: 179px"></textarea><br />
<input id="Reset1" type="reset" value="reset" />
<input id="Submit2" type="submit" value="submit BKM" language=vbscript /></td>
</tr>
</table>
</form>
</asp:Content>

|||

now I get the error when I click submit that says

line 265
char: 1
Error: Type mismatch: 'Submit2_onclick'
Code: 0
URL: http://localhost:1755/rvosd_website/bkm/default.aspx

Tuesday, March 20, 2012

Post SP1 troubles

Access 2003 + Sp1 + adp + ADO 2.8 + SQL Server 2000.
A perfectly working form with subform from two inner joined tables now is
giving me annoying messages when inserting records in the master table.
"Cannot insert a non-null value into a timestamp column. Use INSERT with a
column list or with a default of NULL for the timestamp column."
There's nothing done programmatically, all data bound to form's controls
(obvoiusly not the timestamp field).
Help!
I would use Profiler to determine the exact SQL being passed to the server.
The message is probably correct and the app is probably trying to do what
the message says it is preventing.
Brian Moran
Principal Mentor
Solid Quality Learning
SQL Server MVP
http://www.solidqualitylearning.com
"Atlas" <atlaspeak@.my-deja.com> wrote in message
news:10guprqnccn2g2b@.news.supernews.com...
> Access 2003 + Sp1 + adp + ADO 2.8 + SQL Server 2000.
> A perfectly working form with subform from two inner joined tables now is
> giving me annoying messages when inserting records in the master table.
> "Cannot insert a non-null value into a timestamp column. Use INSERT with a
> column list or with a default of NULL for the timestamp column."
> There's nothing done programmatically, all data bound to form's controls
> (obvoiusly not the timestamp field).
> Help!
>

Post SP1 troubles

Access 2003 + Sp1 + adp + ADO 2.8 + SQL Server 2000.
A perfectly working form with subform from two inner joined tables now is
giving me annoying messages when inserting records in the master table.
"Cannot insert a non-null value into a timestamp column. Use INSERT with a
column list or with a default of NULL for the timestamp column."
There's nothing done programmatically, all data bound to form's controls
(obvoiusly not the timestamp field).
Help!I would use Profiler to determine the exact SQL being passed to the server.
The message is probably correct and the app is probably trying to do what
the message says it is preventing.
Brian Moran
Principal Mentor
Solid Quality Learning
SQL Server MVP
http://www.solidqualitylearning.com
"Atlas" <atlaspeak@.my-deja.com> wrote in message
news:10guprqnccn2g2b@.news.supernews.com...
> Access 2003 + Sp1 + adp + ADO 2.8 + SQL Server 2000.
> A perfectly working form with subform from two inner joined tables now is
> giving me annoying messages when inserting records in the master table.
> "Cannot insert a non-null value into a timestamp column. Use INSERT with a
> column list or with a default of NULL for the timestamp column."
> There's nothing done programmatically, all data bound to form's controls
> (obvoiusly not the timestamp field).
> Help!
>

Post SP1 troubles

Access 2003 + Sp1 + adp + ADO 2.8 + SQL Server 2000.
A perfectly working form with subform from two inner joined tables now is
giving me annoying messages when inserting records in the master table.
"Cannot insert a non-null value into a timestamp column. Use INSERT with a
column list or with a default of NULL for the timestamp column."
There's nothing done programmatically, all data bound to form's controls
(obvoiusly not the timestamp field).
Help!I would use Profiler to determine the exact SQL being passed to the server.
The message is probably correct and the app is probably trying to do what
the message says it is preventing.
--
Brian Moran
Principal Mentor
Solid Quality Learning
SQL Server MVP
http://www.solidqualitylearning.com
"Atlas" <atlaspeak@.my-deja.com> wrote in message
news:10guprqnccn2g2b@.news.supernews.com...
> Access 2003 + Sp1 + adp + ADO 2.8 + SQL Server 2000.
> A perfectly working form with subform from two inner joined tables now is
> giving me annoying messages when inserting records in the master table.
> "Cannot insert a non-null value into a timestamp column. Use INSERT with a
> column list or with a default of NULL for the timestamp column."
> There's nothing done programmatically, all data bound to form's controls
> (obvoiusly not the timestamp field).
> Help!
>

Post method in ASP stops working

I am having an issue on a windows 2003 box where I run a report to a new
window, and I do a request.form to get all my parameters. The first time I
run a report to a new window I am prompted for the windows user name and
password. Once I enter in the login info my report runs fine. Then when I try
to run another report to a new window the request.form doesn't work to pull
things in from my form. Everything is blank, so I get error messages. Another
report will not run until I shutdown IE restart IE log back into my website
and run the report.
My redirect string is
http://Session('sServer')/ReportServer?/Session("sProjectCode")/sReport &
"&rs:Command=render&rs:Format=HTML4.0&rc:Paramaters=False"
Can anyone tell me why the post method or Request.form will only work once
and then I have to restart IE. Again I am opening the report in a new window.
--
Thanks,
CraigI fixed this by going into IIS and going into the properties on the Reports
and ReportServer Virtual directories and under Directory security enabling
anonymous access.
"Craig" wrote:
> I am having an issue on a windows 2003 box where I run a report to a new
> window, and I do a request.form to get all my parameters. The first time I
> run a report to a new window I am prompted for the windows user name and
> password. Once I enter in the login info my report runs fine. Then when I try
> to run another report to a new window the request.form doesn't work to pull
> things in from my form. Everything is blank, so I get error messages. Another
> report will not run until I shutdown IE restart IE log back into my website
> and run the report.
> My redirect string is
> http://Session('sServer')/ReportServer?/Session("sProjectCode")/sReport &
> "&rs:Command=render&rs:Format=HTML4.0&rc:Paramaters=False"
> Can anyone tell me why the post method or Request.form will only work once
> and then I have to restart IE. Again I am opening the report in a new window.
> --
> Thanks,
> Craig

Monday, March 12, 2012

Possible todo some form of DISTINCT filtering?

Hi guys, I have a dataset that returns rows that look like the following
field | value
--
1 | 7
1 | 7
2 | 4
8 | 90
Is it possible to remove the duplicate (1 | 7) row directly within a LIST
control (or similar?)? I cannot use a DISTINCT directly in the SQL as
elsewhere I need to display the duplicate row.
Thanks for any help
TazSilly me, thats what grouping is for lol.
Thanks anyways
Taz