Using "" in Code

Discussion in 'ASP General' started by Mike, Jul 24, 2006.

  1. Mike

    Mike Guest

    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.microsoft.com/cdo/configuration/smtpserver")
    = (rsEmailSettings.Fields.Item("NIDServer").Value)

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

    MyMail.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver")
    = MyServer.MyCompany.Com

    This does not work.

    I need it to be:

    MyMail.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver")
    = "MyServer.MyCompany.Com"

    Where MyServer.MyCompany.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...
     
    Mike, Jul 24, 2006
    #1
    1. Advertising

  2. Mike wrote:
    > If the table has MyServer.MyCompany.Com in it the output is:
    >
    > MyMail.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver")
    > = MyServer.MyCompany.Com
    >
    > This does not work.
    >
    > I need it to be:
    >
    > MyMail.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver")
    > = "MyServer.MyCompany.Com"
    >
    > Where MyServer.MyCompany.Com is enclosed in "".


    In VBScript, you can escape quotes by doubling them. Thus, you want
    something like this:

    MyMail.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver")
    = ("""" & rsEmailSettings.Fields.Item("NIDServer").Value & """")


    Likewise, in JScript:

    MyMail.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver")
    = ("\"" + rsEmailSettings.Fields.Item("NIDServer").Value + "\"")



    --
    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.
     
    Dave Anderson, Jul 24, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Q2FybG8gTWFyY2hlc29uaQ==?=

    Fire Code behind code AND Javascript code associated to a Button Click Event

    =?Utf-8?B?Q2FybG8gTWFyY2hlc29uaQ==?=, Feb 10, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    21,367
    =?Utf-8?B?Q2FybG8gTWFyY2hlc29uaQ==?=
    Feb 11, 2004
  2. Support
    Replies:
    6
    Views:
    3,281
    Support
    Mar 18, 2005
  3. Anders M

    Using inline-code with code behind.

    Anders M, Apr 28, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    7,534
    Karl Seguin
    Apr 28, 2005
  4. keithb
    Replies:
    1
    Views:
    957
    Bruce Barker
    Mar 29, 2006
  5. arvind
    Replies:
    4
    Views:
    21,213
    Kevin Goodsell
    Oct 4, 2003
Loading...

Share This Page