Fuction In Sql - Have A Computation On The Table?
Aug 28, 2009
[code]...
i would like to have a computation on the table (in sql) im creating en example computation:
Dim FiKg As Integer = ((txtFeNum.Text * txtFiFe.Text + txtMaNum.Text * txtFiMa.Text) * 7 / 1000)
Dim FemaleNum As String = txtFeNum.Text
Dim MaleNum As String = txtMaNum.Text
[code]...
View 1 Replies
ADVERTISEMENT
Aug 29, 2009
for example i have this table
x ! y ! z ! Result !
54 ! 12 ! 5 ! !
54 came from --> Textbox1.Text
12 came from --> Textbox2.Text
5 came from --> Textbox3.Text
and i will display the result at row rowResult
[Code]...
View 1 Replies
Dec 13, 2011
I want to write binary file in loop.To write data to hexadecimal use this function.Private Sub Write (ByVal TargetFile As String, ByVal FileOffset As Long, ByVal NewValue As Byte)
Dim br As BinaryReader = New BinaryReader(File.Open(TargetFile, FileMode.Open))
br.BaseStream.Position = FileOffset
br.BaseStream.WriteByte(NewValue)
br.Close()
End Sub How could i write file using a loop in listbox loaded with hex values? The sequence is repeated every 100 bytes.
View 9 Replies
Jun 21, 2010
How can I get the value of the year, month and/or day from the DateTimePicker if I'm trying to compute for the age? I've tried
Dim x As String = ""
x = Date.FromOADate(Val(DateTimePicker1.ToString))
MsgBox(x)
But it only gave me 12:00 AM.
and
DateDiff(DateInterval.Year, DateTimePicker1, Now.Date)
This time it said datetimepicker1 cannot be converted to date.
View 2 Replies
Oct 6, 2011
I am working on program in vb2008 and facing problem in making a PAYROLL SYSTEM.. well, I've done some of its parts and functions but the main part of it is still unsolved -- the computation of tax!! our boss want that when you input a basic monthly salary, the semisalary will be computed.. minus the sss, pag-ibig and philhealth.. then the tax will be computed but also depending on the number of dependents the employee have...
Code:
Private Sub semiSalary_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles semiSalary.Click
If basicSalary.Text = "" Then
MsgBox("Please enter a salary.", MsgBoxStyle.Exclamation, "Invalid")
Else
Dim result2 As Double
[Code] .....
What I've done is that I'm trying to display those values when the the textbox corresponding to it was clicked. We get each value in our database stored on textboxes from the formtables of sss & philhealth.
Attached image(s)
View 5 Replies
Jan 28, 2009
How to display computation process on VB 2008 form?
View 3 Replies
Jun 22, 2010
i'm still developing my project bout evaluation of employees. I'm using the code below,I want to multiply the values of the two specific row/column inside my datatable and then insert the product in the KPIGRDEQUI field in the KWEEKDTL table.Is it possible to be done?
[Code]...
View 1 Replies
Jul 2, 2011
im having a simple computation problem here....
[Code]....
View 2 Replies
Mar 23, 2012
I have a 2 DateTimePicker on my design.1 DateTimePicker for Due Date and another 1 DateTimePicker for Date Returned. Now I would like to automatically compute for penalty which is 24 per day just clicking on the Date Returned's DateTimePicker.For example,A student borrowed a book today and the librarian assigned the due date when to return it.
Take note, the date today is 03/23/2012.and the librarian assigned a due date into 03/25/2012 (the exact date when the student should return it).When the student attempts to return the book at 03/28/2012, and the librarian clicks on the Date Returned's DateTimePicker, the penalty will show as 72 and so on and so for.So I am asking on the codes or tips on how should i do it to make this things work?
View 1 Replies
Apr 3, 2012
I recently made a change to the code within a loop in my code, and now when I run the code through Visual Studio 2010 Express, the loop runs about 10x slower than the previous loop.I did not make any significant changes (to my knowledge) to the code within the loop.I made the change so that the loop could handle various conditions I imposed in another section of the code.I know that it is this loop that is slowing everything down because I report the loop progress on my form.[code]I feel like my changed code should run better, but it doesn't.I know that my code is not written very efficiently (and feel free to comment on ways to improve it), but my main concern is the significant increase in computation time that resulted from my changes.The loop above is the main block of code within the Sub, which is run via a thread.In my tests, it is the only thread running at that time.Everything works, and the computation yields the correct result, but takes 10x longer than previously. Additionally, the number of iterations does not increase.So the new code isn't iterating excessively, it is simply taking much longer to compute within each iteration.
View 19 Replies
Feb 22, 2012
I have been trying to compute the checksum for a line of hex code. This is to create a hex file which will be loaded onto an embedded micro.Some of you guys may not know how this is done so very briefly:
a line of hex bytes:
: 10 01 00 00 21 46 01 36 01 21 47 01 36 00 7E FE 09 D2 19 01 40
The underlined bytes are taken and summed. (in this case the decimal 960). and the bold is the checksum Only the 8LSB (or single least significant byte) is needed to compute the checksum... which in this case, 960 = 03C0 in hex, so only C0 is needed.Two's complement is then taken:
step 1) logical not of C0 which is
step 2) add one (integer)
BIN...........DEC...HEX
[code]....
So here is the code I have been using: (quick mention that in the string passed, the hex bytes are all grouped together, there are no space characters)
Public Sub CreateLine(ByVal Data As String)
'Dim BDataArray(DataLength) As Byte
Dim IDataArray(Data.Length) As Integer
[code]....
where i get into trouble is where i commented 'i get into trouble'. My code works, but it's rather crude Now, in that line i first convert the hex value (string) "SChecksum" into an integer. I want to NOT this, so I get my step 2 from my explanation. However, the results appears to be a signed logical NOT. which gives me the wrong answer. My hashed togther version simply subtracts 256 before the not, in order to give me the correct answer.
Basically, I would love for someone to chime in and point out the flaws in my function, and push me towards figuring out the 'proper' way of doing this. Also I can't quite wrap my head around what would happen in the case a string were passed to my function that is over 16 bits, but I imagine I would have to subtract a larger value than 256, before doing the NOT in this case?(whilst we're on the subject of functions, I've used a 'sub', in which case should I used a sub, and which case should I use a function?).
View 4 Replies
Aug 30, 2009
I want to add a new table in my accdb and copy the content tfrom an existing table into the new one.
Is there an easy way to do this?
View 8 Replies
Dec 21, 2011
I have a data table whose one column is related to a column of another table. I have a listbox in a form which shows a column (which is sorted by another column value by ORDER clause) of the parent table and other columns are in textboxes. The child table is represented by a datagrid. When I add a new item in parent table and click save, the newly created item is listed at the bottom of the listbox violating my ORDER clause. When I wrote some codes to fill data again after updating, it shows an error message[code]...
View 3 Replies
Feb 23, 2010
How do I copy a table to another table without overwriting the contents of the second table?
View 2 Replies
Dec 15, 2010
Let's say, I have something like a table in the WebBrowser component, it's not actually a table, because the data organized in flash, but, it's organized like a table, it has like rows and columns. You can see more in the attached file. Can I transform this text organized as table into DataGridView or some another tool that serves as table. like_a_table.JPG
View 3 Replies
Jul 2, 2009
I have a large form that is set up from master-detail datasets in Visual Studio 2008.I havene master table with a large amount of detail tables. Several of the detail tables also have detail tables linked.Now I need to add a master table that sits on top of my existing master table making it a detail table.
View 7 Replies
Dec 26, 2010
I have a login form that consists of 2 text boxes: txtUser, txtPass. Now these are not bound to any data table & I don't what them to be bound. When a new user enters his user name & password, I want to add these on a data table that has two columns: User, Pass. Data table information: Data Source = Login.accdb, Data table = LoginTable, Connection = LoginCn. I use visual basic 2010. So how do I do this?
View 1 Replies
May 10, 2010
I created a function that creates a global temporary table to stage data from a excel sheet I need the table to persist for me to map the columns using a form. The table is still there when the code goes back to the sub that calls the function until I call the form where I do the mapping. I am trying to avoid create/drop table scenario with a perm stage table.How can I get this table to persist until the data gets loaded into the perm table?
View 8 Replies
Apr 23, 2009
I have this code to edit the datarow of my table adapter but t doesnt update the table. I think i have a missing code that's why but i cant figured it out. by the way im using vb2008 and SQL as my database. [code]
View 3 Replies
May 16, 2011
I have a database that has two tables in it. One is a table of items (table1) and the other is the table of current items (table2).On form load I need to generate a random amount of the items from table1 and populate table2 with them. I was trying to do something like this:
[Code]...
View 2 Replies
Jul 8, 2009
I currently have this working already for one of my combo box's, but when i try to use the same code i get this error ''There is no row at position 6.'' . The are 2 fields in the table asset_type_id, asset_type_name', im trying to dispaly the values in a combo box for the field 'asset_type_name.
the code for ' Friend Sub RetrieveCustomerInformation2()' works but the other friend sub throws the error.
Imports System.Data.SqlClient
Imports System.Data
Imports System
Imports System.Data.OleDb
[Code]...
View 3 Replies
Apr 26, 2009
I got an error when I tried to save a deleted record in a table which I use to store username and password.
I can delete with no problems but the error message popped up when I clicked on the update icon
My login code is like this
Imports System.Data.SqlClient
Public Class Form1
Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As
[Code]....
View 1 Replies
Feb 23, 2011
I have a query that I have to run that requires me to get rows from a table based on the value of a field in another table (which I have gotten earlier). I currently have it done like this (simplified).
[Code]...
View 1 Replies
Nov 13, 2009
I have a project which contains a large number of lookup tables, and I have all of these lookup tables represented in a single typed DataSet, which contains TableAdapters for each lookup. I've designed an editor for these lookup tables, which should allow editing of one of these at a time. My front-end is written in VB and WinForms, the back-end is a SOAP web service; I can successfully pass the changes to the DataSet back to the web service, but can't find a way to use a TableAdapter to update the single table that has been changed.
What I'm trying to do is instantiate the appropriate TableAdapter for the updated DataTable by sending the name of the table back to the web service along with the DataSet, then referring to the TableAdapter with a dynamic name. The normal way to instantiate a TableAdapter is this:
Dim ta As New dsLookupsTableAdapters.tlkpMyTableTableAdapter
What I'd like to do is this, but of course it doesn't work:
strTableName = "tlkpMyTable"
Dim ta As New dsLookupsTableAdapters(strTableName & "TableAdapter")
Is there any way to achieve this, or am I taking the wrong approach altogether? My other alternative is to write separate code for each table, which I'd prefer to avoid!
View 4 Replies
Sep 26, 2008
An unhandled exception of type 'System.InvalidOperationException' occurred in system.windows.forms.dllerror in line: dbAdp.Update(dbDset) in btnSave_Click, (elseif editflag = true) blockdescription: Update unable to find TableMapping['Table'] or DataTable 'Table'I was also wondering if I could simply use the ExecuteNonQuery for the delete statement, but since I've placed my data in a datarow, I'm not sure if i can actually use it. Any thoughts on this? Btw, this is my first time using a datarow, and I've recently been studying how to use ADO.net.
dr = dbDset.Tables(0).Rows(CurIndex)
dr.Delete()
dbAdp.Update(dbDset.Tables("addresses"))
[code].....
View 2 Replies
Aug 23, 2010
I have two tables Employees and CafeLogs. Some employees can be cashiers and also customers at the Cafe shop.
Table structures:
Employees: EmployeeId(PK) , FirstName, LastName
CafeLogs: LogId (PK), CashierId, EmployeeId, Value, => CashierId and EmployeeId are the data from column EmployeeId of Empoyee table
Table relationship:
Employees 1:N CafeLogs (CashierId (FK))
[code]....
Right now I know how to select only LogId, Employee's name, and , Value, not with Cashier name yet.
Dim query = From log In db.CafeLogs _
Join emp In db.Employees On emp.EmployeeId Equals log.EmployeeId _
Select log.LogId, emp.FirsName, emp.LastName, log.Value
View 1 Replies
Mar 24, 2009
I am getting the error "system.argumentException; Column ' test_id2' does not belong to table Table. At System.Data.GetDataColumn( string columnname0 at system.data.datarow.get_item(string columnName).
This error is occuring right after I set the parametervalues in the report object of the Crystal report.(Note this a visual basic.net 2005 windows form application.)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim cryRpt As New ReportDocument
Dim sql As String
[code]....
The value for the first parameter @Parm_1d1 value to the crystal report version 11 is correct. However, when trying to access the second @Parm_1d2 parameter ,the values past to the crystal report is not correct.
View 2 Replies
Dec 7, 2010
I am using Visual Studio 2010 and SQL Server 2008. I made one preject using Employee table and Employee_Permission Options(Yes/No/Override/Never). I want to both table in form detail view most using combo box. if I used Employee detail view and Employee_Permission Datagridview than its work fine to add/edit/update but if table Employee_permission I used detailview (all Combobox) than I can not add/edit/update records. I can add only employee but can not add record in employee_pemission. I have relationship with two table EmpID in both table Primery key with auto increase in Employee table.
View 1 Replies
Feb 26, 2011
I added a table to my Access database. I added that table to my dataset. Using Database Designer VB Studio, my table and tableadapter show up in the design view. The class definition is in the datasetdesigner.vb, and it shows in the object browser. But, I can't reference it in code. I am a newby and obviously missing somethning.
View 1 Replies
Sep 17, 2009
I am working with a Vb.net 2005 application. On the application I have a Create table button which when clicked creates a table in Sql server with the code shown below;
Code: Private Sub BtnCrtTable_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCrtTable.Click
[Code]...
This is really a pre-defined table and the data is already specified to be inserted to the table. However, my primarily task is to read a flat file which has the data and consider the first line as the column to be column names.
Therefore, initially I created an open dialogue to browse for the text file and store the path such as E:Datafile est.txt, in a TextBox1 visible at run time. Now the task is to change the above "create table" to read the txt file (column names are on the first line) and then create the table in the database.
View 5 Replies