G
Gabriele
Hi to all,
I would like to insert a varchar string I get from a table in the
binary object contained from the TASK_RTF_NOTES field of the MSP_TASKS
table.
I found this vb sub doing this work but I cannot use it because I use
a sql server stored procedure to perform the tranfer.
I would like to write the same procedure in T-SQL but I cannot find
the statement equivalent to 'StrConv(rtf, vbFromUnicode)' in T-SQL
Sub WriteNote(NoteText As String)
' writes RTF data to MSP_TASKS.TASK_RTF_NOTES.
Dim cn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim param As New ADODB.Parameter
Dim sql As String, rtf As String, cnString As String
cnString = " ... "
sql = "update MSP_TASKS set TASK_RTF_NOTES = ? , TASK_HAS_NOTES =
1 ,EXT_EDIT_REF_DATA = '1' where PROJ_ID = 1 and TASK_UID = 2"
rtf="{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0
Arial;}}" & vbNewLine & "\viewkind4\uc1\pard\f0\fs20" & NoteText & "
\par" & vbNewLine & "}" & vbNewLine & vbLf & Chr(0) 'be sure to
specify valid RTF text here including "vbLf & Chr(0)
cn.Open cnString
param.Direction = adParamInput
param.Type = adVarBinary
param.Size = 8000
param.Value = StrConv(rtf, vbFromUnicode)
cmd.ActiveConnection = cn
cmd.CommandText = sql
cmd.Parameters.Append param
cmd.Execute
End Sub
Thanks in advance, any help will be valued!!
Gabriele
I would like to insert a varchar string I get from a table in the
binary object contained from the TASK_RTF_NOTES field of the MSP_TASKS
table.
I found this vb sub doing this work but I cannot use it because I use
a sql server stored procedure to perform the tranfer.
I would like to write the same procedure in T-SQL but I cannot find
the statement equivalent to 'StrConv(rtf, vbFromUnicode)' in T-SQL
Sub WriteNote(NoteText As String)
' writes RTF data to MSP_TASKS.TASK_RTF_NOTES.
Dim cn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim param As New ADODB.Parameter
Dim sql As String, rtf As String, cnString As String
cnString = " ... "
sql = "update MSP_TASKS set TASK_RTF_NOTES = ? , TASK_HAS_NOTES =
1 ,EXT_EDIT_REF_DATA = '1' where PROJ_ID = 1 and TASK_UID = 2"
rtf="{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0
Arial;}}" & vbNewLine & "\viewkind4\uc1\pard\f0\fs20" & NoteText & "
\par" & vbNewLine & "}" & vbNewLine & vbLf & Chr(0) 'be sure to
specify valid RTF text here including "vbLf & Chr(0)
cn.Open cnString
param.Direction = adParamInput
param.Type = adVarBinary
param.Size = 8000
param.Value = StrConv(rtf, vbFromUnicode)
cmd.ActiveConnection = cn
cmd.CommandText = sql
cmd.Parameters.Append param
cmd.Execute
End Sub
Thanks in advance, any help will be valued!!
Gabriele