0

guyz i need your help..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? please see attached screen shot for what I encountered when the program executes..hope you help me here guyz.

scmd = New SqlCommand("INSERT INTO KWEEKDTL(KPIGRDEQUI) VALUES(('" & dtcheck.Rows(0).Item(5) & "' * '" & dtcheck.Rows(0).Item(8) & "' ))", sqlcon)
                    scmd.CommandType = CommandType.Text
                    sqlcon.Open()
                    dr = scmd.ExecuteReader
                    dr.Read()
                    sqlcon.Close()

Edited by __avd: Added [code] tags.

Attachments hey.JPG 61.46 KB
2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by __avd
0

Alway use parameterized query.

scmd = New SqlCommand("INSERT INTO KWEEKDTL(KPIGRDEQUI) VALUES (@para1)",sqlcon)

scmd.Parameters.AddWithValue("@para1",dtcheck.Rows(0).Item(5) & "' * '" & dtcheck.Rows(0).Item(8) & "'")

sqlcon.Open()
scmd.ExecuteNonQuery()
sqlcon.Close()

How to use [code] tags?

[code]
   ....
   .... code here
[/code]

Edited by Dani: Formatting fixed

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.