我有一个 datagridview,它从数据库加载数据。SPENDING_SUM 在数据库中是双倍的,但我想在 datagridview 中将其更改为金钱(例如,如果数据库值为 1234567.00,我想在 datagridview 中显示的是 $1,234,567.00)。不知道如何转换价值。
相关代码为:
Using connObj As New SqlClient.SqlConnection(My.Settings.dbConnectionString)
connObj.Open()
querySql = "SELECT UPPER(USER_ID) AS 'USER ID', UPPER(USER_NAME) AS 'USER NAME', " & vbCrLf &
"CONVERT(varchar,JOIN_DATE, 103) AS 'JOIN DATE'," & vbCrLf &
"SPENDING_SUM AS 'SPENDING SUM' FROM USERS WHERE USER_NAME = " & vbCrLf &
querySql = querySql + userName.Text
Try
adapter = New SqlDataAdapter(querySql, connObj)
adapter.Fill(ds)
DataGridView1.DataSource = ds.Tables(0)
Catch ex As Exception
logger.Error(ex.ToString)
End Try
connObj.Close()
End Using