PHYTON: Problem with loop while in hangman game - while-loop

When i put a letter in the code it works well but when im gona out another letter the code reboots and the former letter disappear.
For example, i put "a" and the word is in fifth place, the code ask me another time, i put another, and the letter "a" dissapear, what can i do :(
Help me
aadsadas
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
from random import *
lista_palabras = ["arbol","flor","melocoton","alicante","deportes","tecnologia","felicidad","emilio"]
palabra =choice(lista_palabras)
palabra = palabra.upper()
respuesta = input("Elige una letra: ")
respuesta = respuesta.upper()
num_letras = len(palabra) #esto cuenta cuantas letras tiene una palabra
intentos = 8
lista = []
lista.append("-" * num_letras) # esto añade un guion por cada letra que tenga la palabra
lista = " ".join(lista)
while intentos > 1:
if respuesta in palabra:
ind = palabra.index(respuesta)
if ind == 0:
print(respuesta)
print(lista)
print(f"{intentos} intentos")
respuesta = input("Elige otra letra: ")
continue
elif ind ==1:
print(" " + respuesta)
print(lista)
print(f"{intentos} intentos")
respuesta = input("Elige otra letra: ")
continue
elif ind ==2:
print(" " + " " + respuesta)
print(lista)
print(f"{intentos} intentos")
respuesta = input("Elige otra letra: ")
continue
elif ind == 3:
print(" " + " " + " " + respuesta)
print(lista)
print(f"{intentos} intentos")
respuesta = input("Elige otra letra: ")
continue
elif ind == 4:
print(" " + " " + " " + " " + respuesta)
print(lista)
print(f"{intentos} intentos")
respuesta = input("Elige otra letra: ")
continue
elif ind == 5:
print(" " + " " + " " + " " + " " + respuesta)
print(lista)
print(f"{intentos} intentos")
respuesta = input("Elige otra letra: ")
continue
elif ind == 6:
print(" " + " " + " " + " " + " " + " " + respuesta)
continue
elif ind == 7:
print(" " + " " + " " + " " + " " + " " + " " + respuesta)
print(lista)
print(f"{intentos} intentos")
respuesta = input("Elige otra letra: ")
continue
elif ind == 8:
print(" " + " " + " " + " " + " " + " " + " " + " " + respuesta)
print(lista)
print(f"{intentos} intentos")
respuesta = input("Elige otra letra: ")
continue
elif ind == 9:
print(" " + " " + " " + " " + " " + " " + " " + " " + " " + respuesta)
print(lista)
print(f"{intentos} intentos")
respuesta = input("Elige otra letra: ")
continue
else:
print(" " + " " + " " + " " + " " + " " + " " + " " + " " + " " + respuesta)
print(lista)
print(f"{intentos} intentos")
respuesta = input("Elige otra letra: ")
continue
else:
intentos = intentos-1
print(lista)
print(f"{intentos} intentos")
respuesta = input("Elige una letra: ")
continue

Related

SQLCMD is not executed through asp.net application

I have asp.net application to upload database on a remote server using SQLCMD, but the command is not executed. If I execute it in cmd directly it works fine. Here is the code
Dim output
Dim result As String = ""
p.StartInfo.UseShellExecute = False
p.StartInfo.CreateNoWindow = True
p.StartInfo.RedirectStandardInput = True
p.StartInfo.RedirectStandardOutput = True
p.StartInfo.RedirectStandardError = True
p.StartInfo.Verb = "runas"
p.StartInfo.FileName = "cmd.exe"
'p.StartInfo.Arguments = "/c sqlcmd -S " + serverIP + " -U " + sa + " -P " + P#ssw0rd + " -Q" + Chr(34) + " RESTORE DATABASE " + txtDatabaseName.Text + " FROM DISK=" + Chr(39) + dbPath + Chr(39) + " with move " + Chr(39) + oldmdf + Chr(39) + " to 'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\" + mdf + Chr(39) + ", move " + Chr(39) + oldLog + Chr(39) + " to 'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\" + txtDatabaseName.Text + "_log.ldf'" + " CREATE Login " + txtDatabaseUser.Text + " WITH PASSWORD = " + Chr(39) + txtDatabasePassword.Text + Chr(39) + ";" + Chr(34)
p.StartInfo.Arguments = "/c sqlcmd -S " + ddlDatabaseServerURL.SelectedValue + " -U " + txtDatabaseServerUsername.Text + " -P " + txtDatabaseServerPassword.Text + " -Q" + Chr(34) + " RESTORE DATABASE " + txtDatabaseName.Text + " FROM DISK=" + Chr(39) + dbPath + Chr(39) + " with move " + Chr(39) + oldmdf + Chr(39) + " to 'F:\MSSQL12.MSSQLSERVER\MSSQL\DATA\" + mdf + Chr(39) + ", move " + Chr(39) + oldLog + Chr(39) + " to 'F:\MSSQL12.MSSQLSERVER\MSSQL\DATA\" + txtDatabaseName.Text + "_log.ldf'" + " CREATE Login " + txtDatabaseUser.Text + " WITH PASSWORD = " + Chr(39) + txtDatabasePassword.Text + Chr(39) + ";" + Chr(34)
Dim strFile As String = "C:\inetpub\vhost\Endpoint_Website\Endpoint_EB\mylog.txt"
Dim fileExists As Boolean = File.Exists(strFile)
Using sw As New StreamWriter(File.Open(strFile, FileMode.OpenOrCreate))
sw.WriteLine(
IIf(fileExists, p.StartInfo.Arguments, Nothing))
End Using
p.Start()
output = p.StandardOutput.ReadToEnd()

VB net. Morse code translator: cut correct signs using Mid() and match them with the letter

I am trying to translate Morse code into text in VB.net.
Using below code, some of the letters in the text stays untranslated. I believe the problem is with "oddel" which should indicated how many letters should be cut in Mid(morsC, i, oddel), while selecting the case.
Code should be able to translate this >…./ ./ .-../ .-../ ---/< into Hello.
What's weird is that while translating "Hello", first letter "H" is correctly cut as " ..../" but it's not matched with the Case "H"
'Hello = …./ ./ .-../ .-../ ---/
Sub EE15a()
Dim veta As String, morsCod As String, st As String
morsCod = InputBox("Enter the morse code.")
veta = morsCodF(morsCod)
st = "Preklad dle funkce " + Chr(10) + veta + Chr(10)
MsgBox(st)
End Sub
Function morsCodF(morsC As String) As String
Dim pismeno As String, znak As String
Dim i As Integer, j As Integer, oddel As Integer
Dim nasel As Boolean
znak = "/"
morsC = Trim(morsC)
j = 1
For i = 1 To (morsC.Length)
i = j
Do
If Mid(morsC, j, 1) = znak Then
oddel = j - oddel
nasel = True
Exit Do
End If
j = j + 1
Loop Until nasel = True Or j > (morsC.Length)
If i = 1 Then
pismeno = (" " + Mid(morsC, i, oddel))
Else
pismeno = Mid(morsC, i, oddel)
End If
Select Case pismeno '" ...-/"
Case " .-/" : morsCodF = morsCodF + " a"
Case " -.../" : morsCodF = morsCodF + " b"
Case " -.-./" : morsCodF = morsCodF + " c"
Case " -../" : morsCodF = morsCodF + " d"
Case " ./" : morsCodF = morsCodF + " e"
Case " ..-./" : morsCodF = morsCodF + " f"
Case " --./" : morsCodF = morsCodF + " g"
Case " ..../" : morsCodF = morsCodF + " h"
Case " ../" : morsCodF = morsCodF + " i"
Case " .---/" : morsCodF = morsCodF + " j"
Case " -.-/" : morsCodF = morsCodF + " k"
Case " .-../" : morsCodF = morsCodF + " l"
Case " --/" : morsCodF = morsCodF + " m"
Case " -./" : morsCodF = morsCodF + " n"
Case " ---/" : morsCodF = morsCodF + " o"
Case " .--./" : morsCodF = morsCodF + " p"
Case " --.-/" : morsCodF = morsCodF + " q"
Case " .-./" : morsCodF = morsCodF + " r"
Case " .../" : morsCodF = morsCodF + " s"
Case " -/" : morsCodF = morsCodF + " t"
Case " ..-/" : morsCodF = morsCodF + " u"
Case " ...-/" : morsCodF = morsCodF + " v"
Case " .--/" : morsCodF = morsCodF + " w"
Case " -..-/" : morsCodF = morsCodF + " x"
Case " -.--/" : morsCodF = morsCodF + " y"
Case " --../" : morsCodF = morsCodF + " z"
Case "#" : morsCodF = morsCodF + " "
End Select
nasel = False
pismeno = ""
j = j + 1
Next
End Function
Code should translate whole word or sentence, but instead is translating only part of the text. E.g. > …./ ./ .-../ .-../ ---/
expected: "Hello", actual: "e o"
split the string morsCod with "/" as separator
Public Class Form1
Sub EE15a()
Dim veta As String, morsCod As String, st As String
'morsCod = InputBox("Enter the morse code.")
morsCod = "..../ ./ .-../ .-../ ---/ --"
morsCod = " .-/ -.../ -.-./ -../ ./ ..-./ --./ ..../ ../ .---/ -.-/ .-../ --/ -./ ---/ .--./ --.-/ .-./ .../ -/ ..-/ ...-/ .--/ -..-/ -.--/ --.."
veta = morsCodF(morsCod)
st = "Preklad dle funkce " + Chr(10) + veta + Chr(10)
MsgBox(st)
End Sub
Function morsCodF(morsC As String) As String
Dim arr As String() = morsC.Split("/"c)
For Each s As String In arr
Select Case s
Case " .-" : morsCodF = morsCodF + " a"
Case " -..." : morsCodF = morsCodF + " b"
Case " -.-." : morsCodF = morsCodF + " c"
Case " -.." : morsCodF = morsCodF + " d"
Case " ." : morsCodF = morsCodF + " e"
Case " ..-." : morsCodF = morsCodF + " f"
Case " --." : morsCodF = morsCodF + " g"
Case " ...." : morsCodF = morsCodF + " h"
Case " .." : morsCodF = morsCodF + " i"
Case " .---" : morsCodF = morsCodF + " j"
Case " -.-" : morsCodF = morsCodF + " k"
Case " .-.." : morsCodF = morsCodF + " l"
Case " --" : morsCodF = morsCodF + " m"
Case " -." : morsCodF = morsCodF + " n"
Case " ---" : morsCodF = morsCodF + " o"
Case " .--." : morsCodF = morsCodF + " p"
Case " --.-" : morsCodF = morsCodF + " q"
Case " .-." : morsCodF = morsCodF + " r"
Case " ..." : morsCodF = morsCodF + " s"
Case " -" : morsCodF = morsCodF + " t"
Case " ..-" : morsCodF = morsCodF + " u"
Case " ...-" : morsCodF = morsCodF + " v"
Case " .--" : morsCodF = morsCodF + " w"
Case " -..-" : morsCodF = morsCodF + " x"
Case " -.--" : morsCodF = morsCodF + " y"
Case " --.." : morsCodF = morsCodF + " z"
Case "#" : morsCodF = morsCodF + " "
End Select
Next
End Function
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
EE15a()
End Sub
End Class
If you need some letters uppercase, you need provide additional logic (for instance, first letter is always uppercase). The following code creates dictionary with codes and their letters, parses Morse code string with Regex, extracting codes one-by-one and fetching letters based on these codes. I have created two versions - with Regex and Split.
Dim morse = New Dictionary(Of String, String) From
{
{".-", "a"},
{"-...", "b"},
{"-.-.", "c"},
{".", "e"},
{"....", "h"},
{".-..", "l"},
{"---", "o"},
{"#", " "}
}
Dim s = "..../ ./ .-../ .-../ ---/"
'// 1. REGEX
'// Search for '.', '-' and '#' in any combinations followed by '/'
Dim mc = Regex.Matches(s, "[\.\-#]+(?=/)")
'// Fetch each code from dictionary and concatenate them
Dim x = String.Join("", mc.Cast(Of Match).Select(Function(m) morse(m.Value)))
'// 2. SPLIT
'// Dim x = String.Join("", s.Split({"/"}, StringSplitOptions.RemoveEmptyEntries).
'// Select(Function(z) morse(z.Replace("/", "").Trim())))
Console.WriteLine(x)
'// Output: hello
I think you will get more feedback of the code if you add default case for the Select Case switch.
Select Case s
Case " .-" : morsCodF = morsCodF + " a"
Case "#" : morsCodF = morsCodF + " "
Case Else : morsCodF = morsCodF + " WRONG! "
End Select
Check does this line oddel = j - oddel works as expected.
Based on the logic you have oddel should be amount of characters after previously found / character. If so, then calculation oddel = j - oddel doesn't look right.
Because you updating i with current j calculation should be oddel = j - (i -1)
Check For loop.
Because i updated every time with current value of j, code will make one extra loop which will produce "wrong" value.
Other suggestions.
Decoding morse code to the text is simple mapping from one string to another.
In vb.net Dictionary(Of String, String) could be good tool for this.
Do you really need / character? Instead you can use simple space as letter delimeter.
Function FromMorse(code As String) As String
Const DELIMETER As Char = " "c
Static Secret As New Dictionary(Of String, String) From
{
{".-", "a"},
{"-...", "b"},
{"-.-.", "c"},
{"-..", "d"},
{".", "e"},
{"..-.", "f"},
{"--.", "g"},
{"....", "h"},
{"..", "i"},
{".---", "j"},
{"-.-", "k"},
{".-..", "l"},
{"--", "m"},
{"-.", "n"},
{"---", "o"},
{".--.", "p"},
{"--.-", "q"},
{".-.", "r"},
{"...", "s"},
{"-", "t"},
{"..-", "u"},
{"...-", "v"},
{".--", "w"},
{"-..-", "x"},
{"-.--", "y"},
{"--..", "z"},
{"#", " "}
}
Return code.Split(DELIMETER).
Select(Function(c) Secret(c)).
Aggregate(New StringBuilder(), Function(b, c) b.Append(c)).
ToString()
End Function
Usage
Dim code = ".... . .-.. .-.. --- # .-- --- .-. .-.. -.."
Dim decoded = FromMorse(code)
Console.WriteLine(decoded) ' => "hello world"
A Dictionary for fast look-up, String.Split for brevity and a StringBuilder to keep from creating new strings on every iteration.
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim s As String = GetTextFromMorse("..../ ./ .-../ .-../ ---/")
Debug.Print(s)
End Sub
Private DictCode As New Dictionary(Of String, String) From
{
{".-", "a"},
{"-...", "b"},
{"-.-.", "c"},
{"-..", "d"},
{".", "e"},
{"..-.", "f"},
{"--.", "g"},
{"....", "h"},
{"..", "i"},
{".---", "j"},
{"-.-", "k"},
{".-..", "l"},
{"--", "m"},
{"-.", "n"},
{"---", "o"},
{".--.", "p"},
{"--.-", "q"},
{".-.", "r"},
{"...", "s"},
{"-", "t"},
{"..-", "u"},
{"...-", "v"},
{".--", "w"},
{"-..-", "x"},
{"-.--", "y"},
{"--..", "z"},
{"#", " "}
}
Private Function GetTextFromMorse(input As String) As String
Dim strArray() As String = input.Split({"/"}, StringSplitOptions.RemoveEmptyEntries)
Dim sb As New StringBuilder
For Each s In strArray
sb.Append(DictCode(s.Trim))
Next
Return sb.ToString
End Function

Sending object(json) using vba

Im trying to send json object in Outlook using vba. Here is my code:
Dim Msg As Outlook.MeetingItem
Set Msg = Item
Set recips = Msg.Recipients
Dim regEx As New RegExp
regEx.Pattern = "^\w+\s\w+,\sI351$"
Dim URL As String
URL = "https://webhook.site/55759d1a-7892-4c20-8d15-3b8b7f1bf3b3"
For Each recip In recips
If regEx.Test(recip.AddressEntry) And recip.AddressEntry <> "Application Management Linux1, I351" Then
Dim convertedJson As Object
Set convertedJson = JsonConverter.ParseJson("{""fields"": 123}")
Set xhr = CreateObject("MSXML2.ServerXMLHTTP.6.0")
xhr.Open "POST", URL, False
xhr.setRequestHeader "Content-Type", "application/json"
xhr.Send (convertedJson)
End If
Next
If I send just plane text it works well but i can't send convertedJson. Is it possible to send an object?
UPDATE
I can't even do Debug.Print convertedJson
I was tormented by these libraries in the end I did a very terrible thing
Dim flds, prt, id, smry, descrp, issu, name, lfbrkt, rtbrkt, cma, dbdots, jsTest, issuName As String
flds = "'fields'"
prt = "'project'"
id = "'id'"
smry = "'summary'"
descrp = "'description'"
issu = "'issuetype'"
issuName = "'Improvement'"
name = "'name'"
lfbrkt = "{"
rtbrkt = "}"
cma = ","
dbdots = ":"
jsTest = lfbrkt + flds + dbdots + " " + lfbrkt + vbCrLf + vbTab + prt + dbdots + " " + lfbrkt + vbCrLf + vbTab + vbTab + id + dbdots + " " + "30611" + vbCrLf + vbTab + rtbrkt + cma + vbCrLf + vbTab + smry + dbdots + " " + "'" + CStr(Msg.Subject) + "'" + cma + vbCrLf + vbTab + descrp + dbdots + " " + "'" + CStr(Msg.Body) + "'" + cma + vbCrLf + vbTab + issu + dbdots + " " + lfbrkt + vbCrLf + vbTab + vbTab + name + dbdots + " " + issuName + vbCrLf + vbTab + rtbrkt + vbCrLf + rtbrkt + rtbrkt
And I got this

Sending Email within loop in a function

code is building the email but it is only displaying one row when there is six. I got it correct on the text file but I need it to do the same in the email message. I think I got the for next statement in the wrong location. Here is the example of the code that I am having problem with. I do not know how to place the for next statement without interrupting the vbLine
For Each p In query
If p.Contract_No IsNot Nothing Then
ContractNo = p.Contract_No
Else
ContractNo = " "
End If
If p.Vendor_Name IsNot Nothing Then
VenderName = p.Vendor_Name
Else
VenderName = " "
End If
If p.Termination_Date IsNot Nothing Then
TerminationDate = p.Termination_Date
' ReportDateStr = ReportDate.ToString
TerminationDateStr = String.Format("{0:MM/dd/yyyy}", TerminationDate)
Else
TerminationDateStr = " "
End If
If p.Dept_Name IsNot Nothing Then
DeptName = p.Dept_Name
Else
DeptName = " "
End If
If p.Renewal_Option_Desc IsNot Nothing Then
RenewalOption = p.Renewal_Option_Desc
Else
RenewalOption = " "
End If
If p.Contract_Desc IsNot Nothing Then
ContractDesc = p.Contract_Desc
Else
ContractDesc = " "
End If
If p.Contact_Email IsNot Nothing Then
ContactEmail = p.Contact_Email
Else
ContactEmail = "** N/A ** "
End If
' sends email with attachment
EmailMsgBody = "-- TOTAL # OF CONTRACTS WITH FAILSAFE DATE ON " + DateStr + " IS: " + icnt.ToString + vbCrLf +
vbNewLine + " __________________ " +
vbNewLine +
vbNewLine + " *****Contracts**** " +
vbNewLine + " __________________ " +
vbNewLine +
vbNewLine + "Contract#" + " " + "Vender Name" + " " + "Termination Date" + " " + "Dept Name" + " " + "Renewal Option" + " " + "Contract Desc" + " " + "Email Address" +
vbNewLine + "------------" + " " + "-----------------" + " " + "---------------------" + " " + "--------------" + " " + "--------------------" + " " + "-----------------" + " " + "-----------------" +
vbNewLine + ContractNo.PadRight(18) + " " + _
VenderName.PadRight(38) + " " + _
TerminationDateStr.PadRight(26) + " " + _
DeptName.PadRight(27) + " " + _
RenewalOption.PadRight(45) + " " + _
ContractDesc.PadRight(32) + " " + _
ContactEmail.PadRight(11) + " "

Object reference not set to an instance of an object

Dim In_Total As Integer = 0
Dim Ph_Total As Integer = 0
Dim Day_In_Total As Integer = 0
Dim Day_Ph_Total As Integer = 0
Dim Course_Names1(1) As String
Qry = "SELECT DISTINCT Course_Name,Course_ID FROM Courses WHERE (Course_ID IN (SELECT Course_Id FROM Student_Courses_Pref WHERE student_Id IN (SELECT student_Id FROM Student_Info WHERE Inserted_date >= '" + Now.Month.ToString() + "-1-" + Now.Year.ToString() + "' and Inserted_date <= '" + Now.Date + "' and Branch_Code = '" + BName + "') and Branch_Code = '" + BName + "')) and Branch_Code = '" + BName + "' and Active = 'Y' order by Course_Id"
str = str + "<br> <br> <center><font face ='Verdana' size='+1'><B><U> Summary Report of " + MonthName(Now.Month()).ToString() + "," + Now.Year.ToString() + "</B></U> <br><br>"
com.CommandText = Qry
com.Connection = con
dr = com.ExecuteReader
str = str + "<table align='center' style='FONT-FAMILY: Verdana' bgcolor='#336699' width='100%'>"
str = str + "<tr style='FONT-WEIGHT: bold; FONT-SIZE: x-small;FONT-FAMILY: Verdana' bgColor='#b9ceee'><td align='center' width='3%'> Date </td>"
i = 0
While dr.Read
str = str + "<td align='Center' colspan='2' width='30%'>" + dr(0).ToString() + "</td>"
ReDim Preserve Course_Names1(i)
Course_Names1(i) = dr(1)
i = i + 1
End While
dr.Close()
str = str + "<td colspan ='2'>Total</td></tr>"
For i = 0 To Now.Day
If i = 1 Then
str = str + "<tr style='FONT-SIZE: x-small;FONT-FAMILY: Verdana' bgColor='#b9ceee'><td>" + i.ToString() + "<sup>st</sup>" + MonthName(Now.Month()).Substring(0, 3) + "</td>"
ElseIf i = 2 Then
str = str + "<tr style='FONT-SIZE: x-small;FONT-FAMILY: Verdana' bgColor='#b9ceee'><td>" + i.ToString() + "<sup>nd</sup>" + MonthName(Now.Month()).Substring(0, 3) + "</td>"
ElseIf i = 3 Then
str = str + "<tr style='FONT-SIZE: x-small;FONT-FAMILY: Verdana' bgColor='#b9ceee'><td>" + i.ToString() + "<sup>rd</sup>" + MonthName(Now.Month()).Substring(0, 3) + "</td>"
Else
str = str + "<tr style='FONT-SIZE: x-small;FONT-FAMILY: Verdana' bgColor='#b9ceee'><td>" + i.ToString() + "<sup>th</sup>" + MonthName(Now.Month()).Substring(0, 3) + "</td>"
End If
Qry = ""
For j = 0 To Course_Names1.Length - 1 'Here i got the error
Qry = "select count(student_id),enquiry_by from student_info where inserted_date = '" + MonthName(Now.Month).ToString() + " " + i.ToString() + "," + Now.Year.ToString() + "' and student_id in (select student_id from student_courses_pref where branch_code = '" + BName + "' and Course_id = '" + Course_Names1(j).ToString() + "') and branch_code ='" + BName + "' group by Enquiry_By "
com.CommandText = Qry
dr = com.ExecuteReader
While dr.Read()
If dr.HasRows Then
If UCase(dr(1).ToString()) = "I" Then
'str = str + "<td width='15%' bgcolor='#ffffff'>" + dr(0).ToString() + "</td><td width='15%' bgcolor='#c2ffc8'></td>"
In_Total += dr(0)
ElseIf UCase(dr(1).ToString()) = "P" Then
'str = str + "<td width='15%'bgcolor='#ffffff'></td><td width='15%' bgcolor='#c2ffc8'>" + dr(0).ToString() + "</td>"
Ph_Total += dr(0)
End If
Else
'str = str + "<td width='15%' bgcolor='#ffffff'></td><td width='15%' bgcolor='#c2ffc8'></td>"
End If
End While
If In_Total <> 0 Then
str = str + "<td width='15%' bgcolor='#ffffff'>" + In_Total.ToString() + "</td>"
Else
str = str + "<td width='15%' bgcolor='#ffffff'> </td>"
End If
If Ph_Total <> 0 Then
str = str + "<td width='15%' bgcolor='#c2ffc8'>" + Ph_Total.ToString() + "</td>"
Else
str = str + "<td width='15%' bgcolor='#c2ffc8'> </td>"
End If
dr.Close()
Day_In_Total += In_Total
Day_Ph_Total += Ph_Total
In_Total = 0
Ph_Total = 0
Next
str = str + "<td>" + Day_In_Total.ToString() + "</td><td>" + Day_Ph_Total.ToString() + "</td></tr>"
Day_In_Total = 0
Day_Ph_Total = 0
Next
str = str + "</tr></table>"
Where ist str defined?
Is it initialized with Dim str as string=""???
str = str + "<br> <br>...