Using "" in Code

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike

    Using "" in Code

    I am querying a few fields in a DB table to get To, From, Subj,
    Message, SMTP Server and Port Number info to use CDO to send a
    preformatted message based on what is in this table.

    All works well except on line.

    MyMail.Fields(" http://schemas.microso ft.com/cdo/configuration/smtpserver")
    = (rsEmailSetting s.Fields.Item(" NIDServer").Val ue)

    If the table has MyServer.MyComp any.Com in it the output is:

    MyMail.Fields(" http://schemas.microso ft.com/cdo/configuration/smtpserver")
    = MyServer.MyComp any.Com

    This does not work.

    I need it to be:

    MyMail.Fields(" http://schemas.microso ft.com/cdo/configuration/smtpserver")
    = "MyServer.MyCom pany.Com"

    Where MyServer.MyComp any.Com is enclosed in "".

    I, for the life of me can't figure out how to write this line to do
    it. Can someone give me some info on where to get the code or if you
    know what I am missing, post it for me?

    Thanks...

    Mike...

  • Dave Anderson

    #2
    Re: Using "" in Code

    Mike wrote:
    If the table has MyServer.MyComp any.Com in it the output is:
    >
    MyMail.Fields(" http://schemas.microso ft.com/cdo/configuration/smtpserver")
    = MyServer.MyComp any.Com
    >
    This does not work.
    >
    I need it to be:
    >
    MyMail.Fields(" http://schemas.microso ft.com/cdo/configuration/smtpserver")
    = "MyServer.MyCom pany.Com"
    >
    Where MyServer.MyComp any.Com is enclosed in "".
    In VBScript, you can escape quotes by doubling them. Thus, you want
    something like this:

    MyMail.Fields(" http://schemas.microso ft.com/cdo/configuration/smtpserver")
    = ("""" & rsEmailSettings .Fields.Item("N IDServer").Valu e & """")


    Likewise, in JScript:

    MyMail.Fields(" http://schemas.microso ft.com/cdo/configuration/smtpserver")
    = ("\"" + rsEmailSettings .Fields.Item("N IDServer").Valu e + "\"")



    --
    Dave Anderson

    Unsolicited commercial email will be read at a cost of $500 per message. Use
    of this email address implies consent to these terms.


    Comment

    Working...