I've got a DB connection to my SQL Server on Azure. Two columns are showing on the page but not showing the other 2. Columns are company name and further details
Company Name is standard business name
Further Details stores URLs to more information
I've tried the SQL statement in SQL Management and it displays data what should be shown.
I've checked the parameters of the column, they're both nvarchar(Max) it shows as -1 when clicking to modify the size of the column. Does this mean it has unlimited size?
The file type is Classic ASP with inline CSS and HTML inside.
Below is what is being called in the database.
<%
Session.LCID=2057
Dim connpiudb, rspiudata, strSQL, fldThis, strSQL2, strSQL3, strcategory
strcategory = Request.querystring("category")
Set connpiudb = Server.CreateObject("ADODB.Connection")
Set rspiudata = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT companyname, courtnumber, cronumber, furtherdetails FROM piudata WHERE category LIKE '" & strCategory & "%' Order by companyname"
strValue = Request.QueryString(<%= rspiudata.Fields("companyname") %>)
response.write strSQL
response.write strValue
<!-- strSQL = "SELECT companyname , courtnumber , cronumber, furtherdetails FROM piudata WHERE category LIKE '%c%' Order by companyname" -->
connpiudb.Open strConnect
rspiudata.open strSQL, connpiudb
%>
Below is how the database is stored in the HTML table.
<!--content start-->
<FONT FACE="Arial" size="2">
<TABLE BORDER="0" cellpadding="2" width="60%"><TR>
<%
Do Until rspiudata.EOF
%>
<TR><TD width="40%"><B>Company Name:</B></TD><TD width="60%"><%= rspiudata.Fields("companyname") %></TD></TR>
<TR><TD width="40%"><B>Further Details:</B></TD><TD width="60%"><%=rspiudata.Fields("furtherdetails") %></TD></TR>
<TR><TD width="40%"><B>Court Number:</B></TD><TD width="60%"><%= rspiudata.Fields("courtnumber") %></TD></TR>
<TR><TD width="40%"><B>Company Registered Number:</B></TD><TD width="60%"><%= rspiudata.Fields("cronumber") %></TD></TR>
<TR><TD width="100%" colspan="2"><HR></TD></TR>
<%
rspiudata.movenext
Loop
rspiudata.Close
Set rspiudata = Nothing
connpiudb.close
%>
</TABLE>
I am struggling to understand what the actual issue is. Only thing I've thought of is that the columns sizes default to -1 when setting it as MAX or that Classic ASP does not support NVARCHAR(max)
Any help will be great.
Before going further on this, following code needs to be corrected
<%
...
strValue = Request.QueryString(<%= rspiudata.Fields("companyname") %>)
I understood you have it for debug purposes however it has neither valid syntax (you inject <% %> within existing server code block nor valid operator (Request.QueryString is for query strings) nor right place (recordset is defined but not opened).
And read about sql injections.
I'am new in VBA DOM oblject and i'm trying to select a specific option in a web page. Unfortunatly that option has an ID name that is the same as others option in the page except for the value of the inner function.
here the web code:
<table class="stati_check" id="ctl00_NetSiuCPH_ctl25">
<tr>
<td>
<span class="check">
<INPUT onclick="if (!boxWorkflow_rbSelect(this)) return;setTimeout('__doPostBack(\'ctl00$NetSiuCPH$ctl25$ctl00$WorkflowState\',\'\')', 0)" tabIndex=0
id=ctl00_NetSiuCPH_ctl25_ctl00_WorkflowState type=radio
value=ONVALIDAPROOF name=ctl00$NetSiuCPH$ctl25$ctl00$WorkflowState>
</span>
<td>
<span class="check">
<INPUT onclick="if (!boxWorkflow_rbSelect(this)) return;setTimeout('__doPostBack(\'ctl00$NetSiuCPH$ctl25$ctl01$WorkflowState\',\'\')', 0)" tabIndex=0
id=ctl00_NetSiuCPH_ctl25_ctl01_WorkflowState type=radio
value=ONANNULA1 name=ctl00$NetSiuCPH$ctl25$ctl01$WorkflowState>
</span>
</td>
</tr>
</table>
As can be see the two ID are the same so when I run the VBA code line:
Set pdr_button = ie.Document.getElementById("ctl00_NetSiuCPH_ctl25_ctl00_WorkflowState").click
It will be selected only the first option, but i'm trying to select the ones with the value "ONANNULA1".
I've tried with remove/setatribute:
Set Annulla_Button = ie.Document.getElementById("ctl00_NetSiuCPH_ctl25_ctl00_WorkflowState")
Annulla_Button.removeAttribute ("value")
Annulla_Button.setAttribute ("value"), "ONANNULLA1"
Annulla_Button.Click
However the result is that nothing will be selected.
Can someone help me.
thanks in advance for you patience
So that the strip of code:`
Set TABELLA_STATI = ie.Document.getElementById("ctl00_NetSiuCPH_ctl25").getElementsByTagName("TR")
For Each tr In TABELLA_STATI
Set coltd = tr.getElementsByTagName("TD")
For Each td In coltd
Set option_Button = td.getElementsByTagName("INPUT")
Option_Value = option_Button(0).Value
If InStr(1, Option_Value, "ONANNUL") > 0 Then
option_Button(0).Click
Exit For
End If
Next td
Next tr
`
Hi i want to dynamicly build a div layout depending on the data i send to view, i want make 2 rows of divs and when there is odd number of models sent to view i want the layout to close as you can see in the code every 2nd model or on last model and start div every odd model .... but when i uncomment the commented code there are errors ....
(if i am not mistaken something similar worked in with C# so i hope it's only synax error)
#For Each procesData In Model
curElement = curElement + 1
elemNumb = elemNumb + 1
If (curElement = 1) Then
'#<div id="row"> !Comented
End If
#<h3>Element number #elemNumb</h3>
#<h3>#procesData.Name</h3>
#<h3>#procesData.Status.ToString</h3>
#<br />
If (curElement = Model.Count) Then
If (elemNumb = 1) Then
'#</div> !comented
End If
End If
If (curElement = 2) Then
'#</div> !comented
elemNumb = 0
End If
Next
I tweaked .css file and i managed to 'avoid' my problem but if anyone knows how to solve this without bypassing the original problem i would be greatfull for answer :)
<div id="toggle">
#For Each procesData In Model
curElement = curElement + 1
elemNumb = elemNumb + 1
Dim idName As String = "element" + elemNumb.ToString
#<div id=#idName>
<div class="heading">
#procesData.Name ::::::: Status <img class="statusIMG" id=#procesData.Status.ToString align="right" src="/" />
</div>
<div class="content">
<p>
Dokladniejsze informacje o wskazniku (potrzebne bedzie id zeby wygenerowac partial view! zapamietac)
<br />
np.Html.ActionLink("Edit Me", "Edit", new { id=item.ID })
</p>
</div>
</div>
If (curElement = 2) Then
elemNumb = 0
End If
Next
</div>
I'm fetching records from the SQL Server 2000 database using Classic ASP. This is what the code I have used.
ASP Code:
<form name="search" method="post" onsubmit="return attention();">
<table width="60%" border="0" cellpadding="2" cellspacing="0" style="margin:0 auto">
<tr>
<td colspan="2"><h1 style="color:#003399;">Search for Certificate of Analysis</h1></td>
</tr>
<tr>
<td valign="bottom">Product number <sup style="color:#EE0000;font-size:1.3em">*</sup></td>
<td valign="bottom">Lot number</td>
</tr>
<tr>
<td width="30%" valign="top">
<input type="text" name="input1" size="20"/>
</td>
<td valign="top">
<input type="text" size="20" name="input2"/>
<input style="background-color:#ffffff;border:0px;cursor:pointer" size="10" type="submit" name="sub" value=">>" />
</td>
</tr>
</table>
<%
if request.Form("sub") <> "" then
Dim fname, lname
fname= request.Form("input1")
lname= request.Form("input2")
session("n") = fname & lname
sql = "Select * from search where cat_no_batch_no LIKE '"&request.Form("input1")&"%' OR cat_no_batch_no='"&session("n")&"'"
rs.open sql, con, 1, 2
if rs.eof then
response.write("Please provide a valid Cat No.")
else
do while not rs.eof
%>
<table border="1" cellpadding="5" cellspacing="0" width="60%" style="margin:0 auto; border-collapse:collapse;border-color:#999999">
<tr>
<td width="50%"><%=rs("cat_no_batch_no")%></td>
<td width="10%">Click to open <a target="_blank" href="http://localhost/search1/<%=rs("pdf_path")%>"><%=rs("cat_no_batch_no")%></a></td>
</tr>
</table>
<%
rs.movenext
loop
end if
rs.close
end if
%>
</form>
Above the LIKE statement works as expected and displays multiple records which contains similar Cat No..
Issue rises when I input a Cat No in first Input box and Lot Number in another. My desired output should have been just a single record to display as I have given Cat No. and Lot Number , but it shows multiple records.
I have provided the images to be more clear.
In this image below I have put 6106021 as the product number so it displays two entries.
In this image I have put 6106021 as the product number and 218111 as the Lot Number, it shows two entries instead of 1. This is what the issue, it should show one entry as Lot number are unique while cat number can be the same.
Read your question to yourself and think about what you are saying:
You state "My desired output should have been just a single record to display as I have given Cat No. and Lot Number"
But in your SQL you write where cat_no_batch_no LIKE '"&request.Form("input1")&"%' OR cat_no_batch_no='"&session("n")&"'
The key words are AND vs. OR
In your mind you are thinking both conditions must be true, but your query says otherwise. If you want both conditions to be true then you must use the AND operator.
Naoki is on to something - you are going to have to modify your SQL depending upon which criteria are specified.
I guess you can write two separate SQL queries, according as the "Lot number" is provided or not.
Your code may goes like below:
if lname = "" then
sql = "Select * from search where cat_no_batch_no LIKE '"&request.Form("input1")&"%'"
else
sql = "Select * from search where cat_no_batch_no LIKE '"&session("n")&"%'"
end if
I hope this could help
My application is using PyQt4 and Python3 (I dont know how to backport it to python2.7). I have a need to export PDF and also print to paper. My search for reporting tool ended nowhere, since ReportLab nor POD support python3. Somehow, I managed to create PDF files with this kind of...hassle.
tekstStampa = (str("%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%sIme stranke: %s%sBroj predmeta: %s%sSudski broj: %s%s%sPredmet otvoren: %s%sDatum rasprave: %s u %s sati%s%sStatus stranke: %s%sStatus predmeta: %s%sTip postupka: %s%sVrednost spora: %s dinara.%s%sSud: %s%sSudska jedinica: %s%sSudija: %s%s%sNapomena: %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s" %
(zaglavlje1,'<br>',zaglavlje2,'<br>',zaglavlje3,'<br>',zaglavlje4,'<br>','<br>',
linija,'<br>','<br>','<br>',prazno50,zaglavlje5,brPredmeta,'<br>',prazno51,'<font size="1">datum Å¡tampanja: ',datumStampe,'</font><br>','<br>',
tempime, '<br>',brPredmeta,'<br>', tempsudskibr,'<br>','<br>',
tempdatumtuzba, '<br>', tempdatumRas,tempvreme,'<br>','<br>',
tempstatusstr,'<br>',tempstatusPredmeta,'<br>',temptip,'<br>',tempvrednost,'<br>','<br>',
tempsud,'<br>',tempsudska,'<br>',tempsudija,'<br>','<br>',
'<br>',tempnapomena,'<br>','<br>',
linija, '<br>', '<br>',futer1,'<br>',
futer2,'<br>',
futer3,'<br>',
futer4,'<br>',
futer5,'<br>',)))
self.ui.textStampa.setHtml(str(tekstStampa).replace('\\n','\r'))
As you can see, it's pretty messy, but the output looks acceptable. Not quite good, only acceptable. Example
Now, I need to generate something like this. Columns should be placed in fixed positions, column width is pre-determined. Rows are generated from list, which is queried from database. Quering is fine, I can get the data, but PAGE FORMATTING is killing me.
I have tried to use HTML tags (namely PRE for preformatted text, but it looks ugly) but I wasn't able to accomplish what I wanted.
Thank you in advance.
for tuple in sviaktivni: # extract variables from list of tuples
tempid,ime,brPredmeta,statusStr,sudskiBr ,sudija ,datumRasprave, vreme, zaduzen,datumZaduzenja = tuple
brojac +=1
tekst = ('<html><head><title></title>' #variable which contains HTML tables
'<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>'
'<style></style>'
'</head>'
'<body>'
'<table align ="center" border="0" width="100%" style="table-layout:fixed">'
'<tr height="10%">'
'<td align="left" width="3%">'+str(brojac)+' </td>'
'<td align="left" width="15%">'+ime+' </td>'
'<td align="left" width="10%"> '+brPredmeta+' </td>'
'<td align="left" width="10%"> '+statusStr+' </td>'
'<td align="left" width="10%"> '+sudskiBr+' </td>'
'<td align="left" width="18%"> '+sudija+' </td>'
'<td align="left" width="15%"> '+zaduzen+' </td>'
'<td align="left"> '+datumZaduzenja+' </td>'
'</tr>'
'</table>'
'</body>'
'</html>')
self.ui.textStampa.append(tekst) #append with every iteration