|
error is the syntax mistake.
bug is the logical error that take place at run time.
defects ....... i don;t know
-- modified at 0:19 Thursday 26th July, 2007
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
there is a small difference between
defect,bug and error.
defect:missing requirement
bug:missing functionality
error:cosmetic
hope this will helpfull for u
Basharat
|
|
|
|
|
I have no idea where the other replies got their definitions from, but I'd say the difference is entirely semantic. They all need to be fixed
Seriously, I can't percieve of a situation where a bug is not a defect. I can't imagine ever calling them 'errors', however, an error is what occurs when there is a bug.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I almost agree:
Bug is just another word for defect.
But an error is not always caused by a bug. An error can be a desired behaviour. Take a calculator and divide 100 by 0 --> Error
-^-^-^-^-^-
no risk no funk
|
|
|
|
|
Is any able to reduce this code to a minimal try~~!!!
<br />
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load<br />
If Not IsPostBack Then<br />
Dim conn1 As New Data.SqlClient.SqlConnection("datasource=.\SQLEXPRESS;initial catalog=C:\DOCUMENTS AND SETTINGS\PROJ\APP_DATA\DATABASE.MDF;integrated security = true")<br />
<br />
Dim sql1 As New Data.SqlClient.SqlCommand("select status from carpark where Lot_id=101", conn1)<br />
Dim sql2 As New Data.SqlClient.SqlCommand("select status from carpark where Lot_id=102", conn1)<br />
Dim sql3 As New Data.SqlClient.SqlCommand("select status from carpark where Lot_id=103", conn1)<br />
Dim sql4 As New Data.SqlClient.SqlCommand("select status from carpark where Lot_id=104", conn1)<br />
Dim sql5 As New Data.SqlClient.SqlCommand("select status from carpark where Lot_id=201", conn1)<br />
Dim sql6 As New Data.SqlClient.SqlCommand("select status from carpark where Lot_id=202", conn1)<br />
Dim sql7 As New Data.SqlClient.SqlCommand("select status from carpark where Lot_id=203", conn1)<br />
Dim sql8 As New Data.SqlClient.SqlCommand("select status from carpark where Lot_id=204", conn1)<br />
Dim sql9 As New Data.SqlClient.SqlCommand("select status from carpark where Lot_id=301", conn1)<br />
Dim sql10 As New Data.SqlClient.SqlCommand("select status from carpark where Lot_id=302", conn1)<br />
Dim sql11 As New Data.SqlClient.SqlCommand("select status from carpark where Lot_id=303", conn1)<br />
Dim sql12 As New Data.SqlClient.SqlCommand("select status from carpark where Lot_id=304", conn1)<br />
<br />
Dim haha1 As String<br />
Dim haha2 As String<br />
Dim haha3 As String<br />
Dim haha4 As String<br />
Dim haha5 As String<br />
Dim haha6 As String<br />
Dim haha7 As String<br />
Dim haha8 As String<br />
Dim haha9 As String<br />
Dim haha10 As String<br />
Dim haha11 As String<br />
Dim haha12 As String<br />
<br />
conn1.Open()<br />
<br />
haha1 = CStr(sql1.ExecuteScalar)<br />
haha2 = CStr(sql2.ExecuteScalar)<br />
haha3 = CStr(sql3.ExecuteScalar)<br />
haha4 = CStr(sql4.ExecuteScalar)<br />
haha5 = CStr(sql5.ExecuteScalar)<br />
haha6 = CStr(sql6.ExecuteScalar)<br />
haha7 = CStr(sql7.ExecuteScalar)<br />
haha8 = CStr(sql8.ExecuteScalar)<br />
haha9 = CStr(sql9.ExecuteScalar)<br />
haha10 = CStr(sql10.ExecuteScalar)<br />
haha11 = CStr(sql11.ExecuteScalar)<br />
haha12 = CStr(sql12.ExecuteScalar)<br />
If haha1 = "occupied" Then<br />
Label2.BackColor = Drawing.Color.Green<br />
Label1.Text = "101 is available"<br />
Else<br />
Label2.BackColor = Drawing.Color.Red<br />
Label1.Text = "101 is not available"<br />
End If<br />
<br />
If haha2 = "occupied" Then<br />
Label4.BackColor = Drawing.Color.Green<br />
Label3.Text = "102 is available"<br />
Else<br />
Label4.BackColor = Drawing.Color.Red<br />
Label3.Text = "102 is not available"<br />
End If<br />
<br />
If haha3 = "occupied" Then<br />
Label6.BackColor = Drawing.Color.Green<br />
Label5.Text = "103 is available"<br />
Else<br />
Label6.BackColor = Drawing.Color.Red<br />
Label5.Text = "103 is not available"<br />
End If<br />
<br />
If haha4 = "occupied" Then<br />
Label8.BackColor = Drawing.Color.Green<br />
Label7.Text = "104 is available"<br />
Else<br />
Label8.BackColor = Drawing.Color.Red<br />
Label7.Text = "104 is not available"<br />
End If<br />
<br />
If haha5 = "occupied" Then<br />
Label10.BackColor = Drawing.Color.Green<br />
Label9.Text = "201` is available"<br />
Else<br />
Label10.BackColor = Drawing.Color.Red<br />
Label9.Text = "201 is not available"<br />
End If<br />
<br />
If haha6 = "occupied" Then<br />
Label12.BackColor = Drawing.Color.Green<br />
Label11.Text = "202 is available"<br />
Else<br />
Label12.BackColor = Drawing.Color.Red<br />
Label11.Text = "202 is not available"<br />
End If<br />
<br />
If haha7 = "occupied" Then<br />
Label14.BackColor = Drawing.Color.Green<br />
Label13.Text = "203 is available"<br />
Else<br />
Label14.BackColor = Drawing.Color.Red<br />
Label13.Text = "203 is not available"<br />
End If<br />
<br />
If haha8 = "occupied" Then<br />
Label16.BackColor = Drawing.Color.Green<br />
Label15.Text = "204 is available"<br />
Else<br />
Label16.BackColor = Drawing.Color.Red<br />
Label15.Text = "204 is not available"<br />
End If<br />
<br />
If haha9 = "occupied" Then<br />
Label18.BackColor = Drawing.Color.Green<br />
Label17.Text = "301 is available"<br />
Else<br />
Label18.BackColor = Drawing.Color.Red<br />
Label17.Text = "301 is not available"<br />
End If<br />
<br />
If haha10 = "occupied" Then<br />
Label20.BackColor = Drawing.Color.Green<br />
Label19.Text = "302 is available"<br />
Else<br />
Label20.BackColor = Drawing.Color.Red<br />
Label19.Text = "302 is not available"<br />
End If<br />
<br />
If haha11 = "occupied" Then<br />
Label22.BackColor = Drawing.Color.Green<br />
Label21.Text = "303 is available"<br />
Else<br />
Label22.BackColor = Drawing.Color.Red<br />
Label21.Text = "303 is not available"<br />
End If<br />
<br />
If haha12 = "occupied" Then<br />
Label24.BackColor = Drawing.Color.Green<br />
Label23.Text = "304 is available"<br />
Else<br />
Label24.BackColor = Drawing.Color.Red<br />
Label23.Text = "304 is not available"<br />
End If<br />
conn1.Close()<br />
End If<br />
End Sub<br />
|
|
|
|
|
Is your Lot_id fixed?
Best regard
Pathan
GOD HELP THOSE WHO HELP THEMSELVES
|
|
|
|
|
Wht do u mean by fixed??
The Lot_id is taken from the database
From 101 to 304
101 to 104
then
201 to 204
then
301 to 304
the first digit is the Level followed by the lot id
but in the database its placed as 101
thus each level has 4 lots.
|
|
|
|
|
This code is obviously a nightmare. First of all, try giving your variables real names, not label1, label2, etc.
Then, it seems that you could use the tag property on the label controls to associate labels with a specific Lot_id, then much of this could be done using a loop.
You could actually make one SQL call which returns all statuses, along with the lot ids, and then iterate through the datatable from there.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: If haha2 = "occupied" Then
Label4.BackColor = Drawing.Color.Green
Label3.Text = "102 is availabl
It also seems wrong. If the variable IS occupied, the associated room is set to available.
If haha2 = "occupied" Then
Label4.BackColor = Drawing.Color.Green
Label3.Text = "102 is availabl
|
|
|
|
|
Oh ya i just noticed it actually its surpose to be
if haha2="occupied" then
label4.backColor=Drawing.Color.Red
label3.Text="102 is not available"
else
label4.backColor=Drawing.Color.Green
label3.Text="102 id available"
end if
do u know how i can reduce this big mess of if else loops
|
|
|
|
|
Using labels here is your biggest problem. Is this your code, i.e. can you change the design to not use labels?
|
|
|
|
|
well the labels are to change colors so that the user will know which lots are occupied and not occupied
if there is another way to display this i'm open for suggestion
|
|
|
|
|
i think u have somthing there that can help me but i dun get it perhaps
u could type out a sample code
thanks.
|
|
|
|
|
use the ; to seperate the sql queries in sqlcommand class.
Thus u don't need to specify each and every query in seperate variable.
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
1. Rename your label controls to reflect the lot they represent.1 So, instead of Label1, Label2 , you have Label101Text, Label101Colour .
2. Group all selects into one query.
Dim sqlLotStatus As New Data.SqlClient.SqlCommand("select Lot_id, status from carpark where Lot_id between 101 and 304", conn1)
3. Loop through the result set and set properties on the appropriate labels:
Dim sqlDataReader As Data.SqlClient.SqlDataReader = sqlLotStatus.EndExecuteReader()
Dim lotStatus As String
Dim textLabelName As String
Dim colourLabelName As String
Dim textLabelCtrl As Label
Dim colourLabelCtrl As Label
While sqlDataReader.Read()
' Derive label names.
textLabelName = "Label" & sqlDataReader("Lot_id").ToString() & "Text"
colourLabelName = "Label" & sqlDataReader("Lot_id").ToString() & "Colour"
' Get Label controls with derived names.
textLabelCtrl = CType(Me.FindControl(textLabelName), Label)
colourLabelCtrl = CType(Me.FindControl(colourLabelName), Label)
' Set control properties for lot.
lotStatus = sqlDataReader("status").ToString()
If lotStatus = "occupied" Then
textLabelCtrl.Text = sqlDataReader("Lot_id").ToString() & " is not available"
colourLabelCtrl.BackColor = Drawing.Color.Red
Else
textLabelCtrl.Text = sqlDataReader("Lot_id").ToString() & " is available"
colourLabelCtrl.BackColor = Drawing.Color.Green
End If
End While
1. The ASP.NET Label control lacks the convenient Tag property of the WinForms control.
|
|
|
|
|
You have to be a code guru. When i saw your code OMG i was amazed i'm still a beginner in using visual basic but its a great language.Thanks alot !!;)
|
|
|
|
|
That's probably the only VB.NET code I've written in four years! I did it partly to help you, and partly to see if I could.
This is not an ideal solution, but I think it illustrates an important coding principle, the reduction of duplication. It's biggest shortcoming is having business data coupled to the names of the labels. As an exercise you may want to investigate using a data structure such as a Dictionary to store a collection of Label to Parking Lot associations.
|
|
|
|
|
When I deploy asp.net web application in one server it is working,but when it placed in NLB cluster (deployed in 3 servers )
looking for webform1.aspx file not found error is coming.
Do I need to take any necessary actions during development of application if it has to place in NLB cluster.
we using asp.net 1.0(visual studio 2003)
|
|
|
|
|
I am using the ASP.NET 2.0 Menu Control. All is well except for a little Outline around the first selection of a submenu (dynamic). Our customer desires a nice clean look. So I would like to get rid of the outline.
(Its not a border and it only shows up around the first (or root) node in a dynamic submenu.)
Thanks in advance...
-Dwreck
|
|
|
|
|
I solved my own problem, and understand it a better now, so I can be more specific.
I use two CSS classes...
.menuNormal
{
color:White;
background-color:Blue;
border-color:Blue;
border-width:1px;
border-style:solid;
font-family:Microsoft Sans Serif;
font-size:Smaller;
font-weight:bold;
height:35px;
padding: 3px;
}
.menuHover
{
color:Blue;
background-color:White;
border-color:Blue;
border-width:1px;
border-style:solid;
font-family:Microsoft Sans Serif;
font-size:Smaller;
font-weight:bold;
height:35px;
padding:3px;
}
And make use of an ASP.NET 2.0 Menu Control
<asp:Menu
ID="Menu1"
runat="server"
Orientation="Horizontal"
DataSourceID="siteData"
StaticDisplayLevels="2"
CssClass="menuNormal">
<DynamicHoverStyle CssClass="menuHover"/>
<DynamicMenuItemStyle CssClass="menuNormal"/>
<DynamicMenuStyle CssClass="menuNormal" />
<StaticHoverStyle CssClass="menuHover"/>
<StaticMenuItemStyle CssClass="menuNormal"/>
<StaticMenuStyle CssClass="menuNormal"/>
</asp:Menu>
The code above causes the menu to render with the funny extra border on the root node of dynamic submenus.
Adding HorizontalPadding="0" BorderStyle="None" to the DynamicMenuStyle property fixes this. Example code is shown below.
/<asp:Menu
ID="Menu1"
runat="server"
Orientation="Horizontal"
DataSourceID="siteData"
StaticDisplayLevels="2"
CssClass="menuNormal">
<DynamicHoverStyle CssClass="menuHover"/>
<DynamicMenuItemStyle CssClass="menuNormal"/>
<DynamicMenuStyle CssClass="menuNormal" HorizontalPadding="0" BorderStyle="None" />
<StaticHoverStyle CssClass="menuHover"/>
<StaticMenuItemStyle CssClass="menuNormal"/>
<StaticMenuStyle CssClass="menuNormal"/>
</asp:Menu>
-Dwreck
|
|
|
|
|
Hello All,
Need your help with regards to SSO(Single Sign On). Lets say I have two websites A and B. After user logs on to A(login.aspx) user needs to go a say a default.aspx page and on Default.aspx, there is a button which on click should send the user to website B,(both websites are on the same domain..lets say a.abc.com and b.abc.com) as user is already logged on site A..it should directly send the user to welcome.aspx page on site B. Iam using form authentication. This is what i have in my web.config on both sites.
<authentication mode="Forms">
<forms name=".SSOAUTH" loginUrl="Login.aspx" protection="All" path="/" timeout="30"/>
</authentication>
<authorization>
<deny users="?"/>
<allow users="*"/>
</authorization>
<machineKey validationKey="1234567890" decryptionKey="9876543243" validation="SHA1"/>
On my site A login page, when user enters a login and password, i call a function and go against my DB and validate, if login and pwd match db, i return customerid and the code is as below:
Dim customerid As String = ValidateUser(txtUserName.Value, txtUserPass.Value)
If customerid <> "0" Then '--------Comment-if login is fine, customerid is never 0
Dim tkt As FormsAuthenticationTicket
Dim cookiestr As String
Dim ck As HttpCookie
tkt = New FormsAuthenticationTicket(1, txtUserName.Value, DateTime.Now, DateTime.Now.AddMinutes(30), True, "your custom data")
cookiestr = FormsAuthentication.Encrypt(tkt)
Session("FormData") = cookiestr '------Comment-saving in session for later use
Dim b As String = FormsAuthentication.FormsCookieName
Response.Cookies(b).Domain = .abc.com
Response.Cookies(b)("SiteA") = cookiestr
Response.Cookies(b).Expires = tkt.Expiration
Response.Cookies(b).Path = FormsAuthentication.FormsCookiePath
Response.Redirect("default.aspx")
Dim strRedirect As String
strRedirect = Request("ReturnURL")
If strRedirect <> "" Then
Response.Redirect(strRedirect, True)
Else
strRedirect = "Default.aspx"
Response.Redirect(strRedirect, True)
End If
Else
Response.Redirect("Login.aspx", True)
End If
My problem is it never redirects to Default.aspx on Site A... and from default.aspx on Site A..if i click a button..i need to it go to welcome.aspx on site B... for some weird reason though, it goes back to the login page..and further.. the cookie is set..its not reading it on site B. Please Help !! Any help is appreciated, where am i going wrong? code samples are much appreciated.
RH
|
|
|
|
|
Hi, in the code below the first IF statement is used to determine if a list item is selected and the 2nd is used to determine if my database connection is not empty.
Dim DS As New DataSet
For i = 0 To CarNamesDL.Items.Count - 1
If CarNamesDL.Items(i).Selected Then
DBConn = New OdbcConnection("Driver={MySQL ODBC 3.51 Driver};Server=myServer;Database=CarCompaniesDB;User=myUser;Password=myPass;Option=3;")
DBCommand = New OdbcCommand("SELECT CarID, Model From CarCompaniesDB where Make = '" & CarNamesDL.Items(i).Text & "'", DBConn)
End If
Next
If Not IsNothing(DBConn) Then
DBConn.Open()
DBCommand.Connection = DBConn
Dim AD As New OdbcDataAdapter(DBCommand)
AD.Fill(DS, "CarCompaniesDB")
Me.CarNamesDL.DataTextField = "CarID"
Me.CarNamesDL.DataValueField = "Model"
CarNamesDL.DataBind()
End If
This is the code for the button used to display the result, I don't quite understand it since I got it off the web.
Private Sub Bt_OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bt_OK.Click
lblDataSelected.Text = "Selected Text: " & CarNamesDL.SelectedItem.Text & "<BR> Selected value: " & CarNamesDL.SelectedValue & "<BR> Selected Index: " & CarNamesDL.SelectedIndex
End Sub
The following is the result.
Selected Item: Infinity
Selected Value: Infinity
Selected Index: 1
How do I get it to display the "Model" to the right of Selected Value: instead of displaying the text of the list item that was selected like its doing above? I'd like it to display the model name(s) that have been retrieved from the database. Thank you for your help.
-- modified at 18:58 Wednesday 25th July, 2007
|
|
|
|
|
ASPnoob wrote: I don't quite understand it since I got it off the web.
If you find code online and you don't understand it, read MSDN so that you do. Using code you don't understand is not a wise move. It sure doesn't help you learn anything.
ASPnoob wrote: Me.CarNamesDL.DataTextField = "CarID" Me.CarNamesDL.DataValueField = "Model"
This code means that the value field should contain the value stored in the 'Model' column, and the value shown in the list should be the 'CarID' column. You should probably look at the HTML to see what's being stored in the value field, then you can work out which step is failing to work properly.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi, I understood those two lines perfectly well, its the following line that I'm unsure about even after reading the MSDN.
CarNamesDL.SelectedValue
It supposed to return the value of the selected ListItem but in the tutorial that I was reading " & CarNamesDL.SelectedItem.Text & " and CarNamesDL.SelectedValue & " returned the same value. Thats where I got the code above and its confusing me since its doing something different from what the MSDN said its supposed to do. According to the MSDN, SelectedValue is supposed to return the value stored within the selected listitem. Please correct me if I misunderstood what the MSDN said. Thank you for your response.
-- modified at 21:25 Wednesday 25th July, 2007
|
|
|
|
|
You can obtain the value and displayed text like so:
ddl1.SelectedItem.Value.ToString() / value
ddl1.SelectedItem.Text / displayed text
e.g.
<br />
'//add a few items to the drop down:<br />
ddl1.Items.Add(New ListItem("Honda", "hnd05"))<br />
ddl1.Items.Add(New ListItem("Ford", "frd07"))
The value of the first item would be hnd05 and the text would be Honda.
Hope this helps.
|
|
|
|