Dear Friends,
could you please help me to get the way to read a percent value (0, 0.1,... to 1) in a textbox using % value like 0%, 1% to 100%
my database has a column with name of percentcomp as float but i field to read it through my application that i convert the value to string to be appeared in my text box but unlikely when i convert to string I lose the value. kindly find my code below
Protected Sub DivID_load(ByVal sender As Object, ByVal e As System.EventArgs) Handles DivID.Load
If Not Page.IsPostBack Then
If Not (DivID.Text = "") Then
' Create a Select statement that searches for a record
' matching the specific Call Number from the Value property.
Dim selectSQL As String
selectSQL = " SELECT MasterEntry.EquiryType, DivisionsInv.ID, DivisionsInv.LogNumber , DivisionsInv.SolutionComp, DivisionsInv.Division, DivisionsInv.ProposedValue, DivisionsInv.Employee, DivisionsInv.Status, DivisionsInv.PercentCompl, DivisionsInv.ClosedDate, DivisionsInv.HrsWorked, DivisionsInv.Remarks, Employees.Name, Employees.EmpNumber"
selectSQL &= " FROM MasterEntry INNER JOIN DivisionsInv ON MasterEntry.LogNumber = DivisionsInv.LogNumber INNER JOIN Employees ON DivisionsInv.Employee = Employees.EmpNumber "
selectSQL &= "WHERE DivisionsInv.ID='" & DivID.Text & "' "
selectSQL &= " AND EmpNumber = '" & Profile.EmpNum & "'"
' Define the ADO.NET objects.
Dim strConnString As String = ConfigurationManager.ConnectionStrings("TSDATA2ConnectionString").ConnectionString()
Dim con As New SqlConnection(strConnString)
Dim cmd As New SqlCommand(selectSQL, con)
Dim reader As SqlDataReader
' Try to open database and read information.
Try
con.Open()
reader = cmd.ExecuteReader()
reader.Read()
UpdateButton.Enabled = True
Panel1.Visible = True
' Fill the controls.
' If reader("AccManager").ToString() <> orgn.SelectedValue Then
'UpdateTXT0.Text = "Sorry your are not Authorized"
'End If
EngineerName.Text = reader("Name").ToString()
Eng_LogNumber.Text = reader("LogNumber").ToString
SolutionText.Text = reader("SolutionComp").ToString()
DivisionText.Text = reader("Division").ToString()
ProposedValueText.Text = reader("ProposedValue").ToString()
StatusText.SelectedValue = reader("Status").ToString()
PercentCompl.Text = reader("PercentCompl").ToString()
If Not (reader("ClosedDate").ToString() = "") Then
ClosedDate.SelectedDate = reader("ClosedDate").ToString()
End If
HrsWorked.Text = reader("HrsWorked").ToString()
remark.Text = reader("Remarks").ToString()
TypeText.Text = reader("EquiryType").ToString()
Catch err As Exception
Labelerr.Text = "This Call may not assigned to you or an Error present "
UpdateButton.Enabled = False
Panel1.Visible = False
Finally
con.Close()
End Try
End If
End If
End Sub
Best Regards,
could you please help me to get the way to read a percent value (0, 0.1,... to 1) in a textbox using % value like 0%, 1% to 100%
my database has a column with name of percentcomp as float but i field to read it through my application that i convert the value to string to be appeared in my text box but unlikely when i convert to string I lose the value. kindly find my code below
Protected Sub DivID_load(ByVal sender As Object, ByVal e As System.EventArgs) Handles DivID.Load
If Not Page.IsPostBack Then
If Not (DivID.Text = "") Then
' Create a Select statement that searches for a record
' matching the specific Call Number from the Value property.
Dim selectSQL As String
selectSQL = " SELECT MasterEntry.EquiryType, DivisionsInv.ID, DivisionsInv.LogNumber , DivisionsInv.SolutionComp, DivisionsInv.Division, DivisionsInv.ProposedValue, DivisionsInv.Employee, DivisionsInv.Status, DivisionsInv.PercentCompl, DivisionsInv.ClosedDate, DivisionsInv.HrsWorked, DivisionsInv.Remarks, Employees.Name, Employees.EmpNumber"
selectSQL &= " FROM MasterEntry INNER JOIN DivisionsInv ON MasterEntry.LogNumber = DivisionsInv.LogNumber INNER JOIN Employees ON DivisionsInv.Employee = Employees.EmpNumber "
selectSQL &= "WHERE DivisionsInv.ID='" & DivID.Text & "' "
selectSQL &= " AND EmpNumber = '" & Profile.EmpNum & "'"
' Define the ADO.NET objects.
Dim strConnString As String = ConfigurationManager.ConnectionStrings("TSDATA2ConnectionString").ConnectionString()
Dim con As New SqlConnection(strConnString)
Dim cmd As New SqlCommand(selectSQL, con)
Dim reader As SqlDataReader
' Try to open database and read information.
Try
con.Open()
reader = cmd.ExecuteReader()
reader.Read()
UpdateButton.Enabled = True
Panel1.Visible = True
' Fill the controls.
' If reader("AccManager").ToString() <> orgn.SelectedValue Then
'UpdateTXT0.Text = "Sorry your are not Authorized"
'End If
EngineerName.Text = reader("Name").ToString()
Eng_LogNumber.Text = reader("LogNumber").ToString
SolutionText.Text = reader("SolutionComp").ToString()
DivisionText.Text = reader("Division").ToString()
ProposedValueText.Text = reader("ProposedValue").ToString()
StatusText.SelectedValue = reader("Status").ToString()
PercentCompl.Text = reader("PercentCompl").ToString()
If Not (reader("ClosedDate").ToString() = "") Then
ClosedDate.SelectedDate = reader("ClosedDate").ToString()
End If
HrsWorked.Text = reader("HrsWorked").ToString()
remark.Text = reader("Remarks").ToString()
TypeText.Text = reader("EquiryType").ToString()
Catch err As Exception
Labelerr.Text = "This Call may not assigned to you or an Error present "
UpdateButton.Enabled = False
Panel1.Visible = False
Finally
con.Close()
End Try
End If
End If
End Sub
Best Regards,