asp.net 2.0 网页发送数据邮件和数据库

 网页HTML 部份

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="jphrorder.aspx.cs" Inherits="jphrorder" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
</head>
<body style="background-position-x: 60px; background-repeat: no-repeat">
    <form id="form1" runat="server">
    <div style="left: 40px; position: relative; top: 0px">
       <table border="0" cellpadding="0" cellspacing="0" style="width: 513px; border-right: silver 1px solid; border-top: silver 1px solid; margin-top: 0px; margin-bottom: 0px;margin-left: auto; margin-right: auto; border-left: silver 1px solid; border-bottom: silver 1px solid; left: 20px; color: dimgray; background-repeat: no-repeat; position: absolute; top: 60px; background-color: whitesmoke; font-size: 16px;">
            <tr>
                <td style="width: 72px">
                    <asp:Label ID="Label1" runat="server" Text="会社名"></asp:Label></td>
                <td style="width: 500px">
                    <asp:TextBox ID="txtCompany" runat="server" BorderStyle="Solid" BorderWidth="1px"></asp:TextBox>*<asp:RequiredFieldValidator
                        ID="RequiredFieldValidator1" runat="server" Display="Dynamic" ErrorMessage="暇でないでください"
                        Width="155px" ControlToValidate="txtCompany"></asp:RequiredFieldValidator></td>
            </tr>
            <tr>
                <td style="width: 72px">
                    <asp:Label ID="Label2" runat="server" Text="会社住所" Width="86px"></asp:Label></td>
                <td style="width: 500px">
                    <asp:TextBox ID="txtaddress" runat="server" BorderStyle="Solid" BorderWidth="1px"></asp:TextBox>*<asp:RequiredFieldValidator
                        ID="RequiredFieldValidator2" runat="server" ErrorMessage="暇でないでください" ControlToValidate="txtaddress" Display="Dynamic"></asp:RequiredFieldValidator></td>
            </tr>
            <tr>
                <td style="width: 72px; height: 22px">
                    <asp:Label ID="Label3" runat="server" Text="郵便番号" Width="83px"></asp:Label>
                </td>
                <td style="width: 500px; height: 22px">
                    <asp:TextBox ID="txtorpostal" runat="server" BorderStyle="Solid" BorderWidth="1px"></asp:TextBox></td>
            </tr>
            <tr>
                <td style="width: 72px; height: 27px;">
                    <asp:Label ID="Label4" runat="server" Text="電話番号" Width="81px"></asp:Label>
                </td>
                <td style="width: 500px; height: 27px;">
                    <asp:TextBox ID="txttelephone" runat="server" BorderStyle="Solid" BorderWidth="1px" ></asp:TextBox>*<asp:RequiredFieldValidator
                        ID="RequiredFieldValidator5" runat="server" ControlToValidate="txttelephone"
                        Display="Dynamic" ErrorMessage="暇でないでください"></asp:RequiredFieldValidator></td>
            </tr>
            <tr>
                <td style="width: 72px">
                    <asp:Label ID="Label9" runat="server" Text="Fax"></asp:Label>
                </td>
                <td style="width: 500px">
                    <asp:TextBox ID="txtfax" runat="server" BorderStyle="Solid" BorderWidth="1px"></asp:TextBox>*<asp:RequiredFieldValidator
                        ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtfax" Display="Dynamic"
                        ErrorMessage="暇でないでください"></asp:RequiredFieldValidator></td>
            </tr>
            <tr>
                <td style="width: 72px; height: 25px;">
                    <asp:Label ID="Label11" runat="server" Text="会社URL" Width="89px"></asp:Label>
                </td>
                <td style="width: 500px; height: 25px;">
                    <asp:TextBox ID="txturl" runat="server" BorderStyle="Solid" BorderWidth="1px"></asp:TextBox></td>
            </tr>
            <tr>
                <td style="width: 72px; height: 27px">
                    <asp:Label ID="Label13" runat="server" Text="社員数"></asp:Label>
                </td>
                <td style="width: 500px; height: 27px">
                    <asp:TextBox ID="txtcount" runat="server" BorderStyle="Solid" BorderWidth="1px"></asp:TextBox></td>
            </tr>
            <tr>
                <td style="width: 72px; height: 23px;">
                    <asp:Label ID="Label15" runat="server" Text="企業国籍" Width="84px"></asp:Label>
                </td>
                <td style="width: 500px; height: 23px;">
                    <asp:DropDownList ID="txtcompanycountry" runat="server" Width="200px">
                        <asp:ListItem Selected="True">選択して下さい</asp:ListItem>
                        <asp:ListItem>中国</asp:ListItem>
                        <asp:ListItem>日本</asp:ListItem>
                        <asp:ListItem>欧米</asp:ListItem>
                        <asp:ListItem>その他</asp:ListItem>
                    </asp:DropDownList></td>
            </tr>
            <tr>
                <td style="width: 72px; height: 27px;">
                    <asp:Label ID="Label17" runat="server" Text="ご担当者" Width="85px"></asp:Label></td>
                <td style="width: 500px; height: 27px;">
                    <asp:TextBox ID="txtconnect" runat="server" BorderStyle="Solid" BorderWidth="1px"></asp:TextBox>*<asp:RequiredFieldValidator
                        ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtconnect" Display="Dynamic"
                        ErrorMessage="暇でないでください"></asp:RequiredFieldValidator></td>
            </tr>
            <tr>
                <td style="width: 72px">
                    <asp:Label ID="Label5" runat="server" Text="部署/職位" Width="106px"></asp:Label></td>
                <td style="width: 500px">
                    <asp:TextBox ID="txtconnectjob" runat="server" BorderStyle="Solid" BorderWidth="1px"></asp:TextBox></td>
            </tr>
            <tr>
                <td style="width: 72px">
                    <asp:Label ID="Label16" runat="server" Text="携帯電話" Width="96px"></asp:Label></td>
                <td style="width: 500px">
                    <asp:TextBox ID="txtcellphone" runat="server" BorderStyle="Solid" BorderWidth="1px"></asp:TextBox></td>
            </tr>
            <tr>
                <td style="width: 72px">
                    <asp:Label ID="Label18" runat="server" Text="Email"></asp:Label></td>
                <td style="width: 500px">
                    <asp:TextBox ID="txtemail" runat="server" BorderStyle="Solid" BorderWidth="1px"></asp:TextBox></td>
            </tr>
            <tr>
                <td style="width: 72px">
                    <asp:Label ID="Label14" runat="server" Text="経営内容" Width="91px"></asp:Label></td>
                <td style="width: 500px">
                    <asp:TextBox ID="txtContent" runat="server" Rows="5" TextMode="MultiLine" Width="300px" BorderStyle="Solid" BorderWidth="1px">经营内容</asp:TextBox></td>
            </tr>
            <tr>
                <td style="width: 72px; height: 22px">
                    <asp:Label ID="Label12" runat="server" Text="職位"></asp:Label></td>
                <td style="width: 500px; height: 22px">
                    <asp:TextBox ID="txtjob" runat="server" BorderStyle="Solid" BorderWidth="1px"></asp:TextBox></td>
            </tr>
            <tr>
                <td style="width: 72px; height: 25px;">
                    <asp:Label ID="Label10" runat="server" Text="職位現状" Width="84px"></asp:Label></td>
                <td style="width: 500px; height: 25px;">
                    <asp:DropDownList ID="cobstatus" runat="server" Width="205px">
                        <asp:ListItem>増員</asp:ListItem>
                        <asp:ListItem>欠員</asp:ListItem>
                        <asp:ListItem>代替</asp:ListItem>
                        <asp:ListItem Selected="True">選択して下さい</asp:ListItem>
                    </asp:DropDownList></td>
            </tr>
            <tr>
                <td style="width: 72px; height: 23px">
                    <asp:Label ID="Label7" runat="server" Text="国籍"></asp:Label></td>
                <td style="width: 500px; height: 23px">
                    <asp:DropDownList ID="cobcountry" runat="server" Width="206px">
                        <asp:ListItem>中国人</asp:ListItem>
                        <asp:ListItem>日本人</asp:ListItem>
                        <asp:ListItem>問わず</asp:ListItem>
                        <asp:ListItem Selected="True">選択して下さい</asp:ListItem>
                    </asp:DropDownList></td>
            </tr>
            <tr>
                <td style="width: 72px; height: 22px">
                    <asp:Label ID="Label8" runat="server" Text="年齢"></asp:Label></td>
                <td style="width: 500px; height: 22px">
                    <asp:TextBox ID="txtold" runat="server" BorderStyle="Solid" BorderWidth="1px">25</asp:TextBox></td>
            </tr>
            <tr>
                <td style="width: 72px; height: 23px">
                    <asp:Label ID="Label6" runat="server" Text="性別"></asp:Label></td>
                <td style="width: 500px; height: 23px">
                    <asp:DropDownList ID="cobsex" runat="server" Width="205px">
                        <asp:ListItem>男性</asp:ListItem>
                        <asp:ListItem>女性</asp:ListItem>
                        <asp:ListItem>問わず</asp:ListItem>
                        <asp:ListItem Selected="True">選択して下さい</asp:ListItem>
                    </asp:DropDownList></td>
            </tr>
            <tr>
                <td style="width: 72px; height: 25px;">
                    <asp:Label ID="Label19" runat="server" Text="勤務地"></asp:Label></td>
                <td style="width: 500px; height: 25px;">
                    <asp:TextBox ID="txtplace" runat="server" BorderStyle="Solid" BorderWidth="1px"></asp:TextBox></td>
            </tr>
           <tr>
               <td style="width: 72px; height: 25px">
                   <asp:Label ID="Label21" runat="server" Text="学歴"></asp:Label></td>
               <td style="width: 500px; height: 25px">
                   <asp:DropDownList ID="cobEducational" runat="server" Width="203px">
                       <asp:ListItem Selected="True">選択して下さい</asp:ListItem>
                       <asp:ListItem>高等学校</asp:ListItem>
                       <asp:ListItem>専門学校</asp:ListItem>
                       <asp:ListItem>大専</asp:ListItem>
                       <asp:ListItem>大学</asp:ListItem>
                       <asp:ListItem>大学院</asp:ListItem>
                       <asp:ListItem>問わず</asp:ListItem>
                   </asp:DropDownList></td>
           </tr>
           <tr>
               <td style="width: 72px; height: 25px">
                   <asp:Label ID="Label22" runat="server" Text="PCレベル" Width="95px"></asp:Label></td>
               <td style="width: 500px; height: 25px">
                   <asp:TextBox ID="txtPcable" runat="server"></asp:TextBox></td>
           </tr>
           <tr>
               <td style="width: 72px; height: 25px">
                   <asp:Label ID="Label23" runat="server" Text="外国語"></asp:Label></td>
               <td style="width: 500px; height: 25px">
                   <asp:DropDownList ID="cobForeignlanguage" runat="server" Width="204px">
                       <asp:ListItem Selected="True">選択して下さい</asp:ListItem>
                       <asp:ListItem>中国語</asp:ListItem>
                       <asp:ListItem>日本語</asp:ListItem>
                       <asp:ListItem>英語</asp:ListItem>
                       <asp:ListItem>韓国語</asp:ListItem>
                       <asp:ListItem>その他</asp:ListItem>
                   </asp:DropDownList></td>
           </tr>
           <tr>
               <td style="width: 72px; height: 25px">
                   <asp:Label ID="Label24" runat="server" Text="月給"></asp:Label></td>
               <td style="width: 500px; height: 25px">
                   <asp:TextBox ID="txtSalary" runat="server"></asp:TextBox></td>
           </tr>
           <tr>
               <td style="width: 72px; height: 25px">
                   <asp:Label ID="Label25" runat="server" Text="手当て"></asp:Label></td>
               <td style="width: 500px; height: 25px">
                   <asp:TextBox ID="txtsubsidy" runat="server"></asp:TextBox></td>
           </tr>
           <tr>
               <td style="width: 72px; height: 25px">
                   <asp:Label ID="Label26" runat="server" Text="勤務時間" Width="102px"></asp:Label></td>
               <td style="width: 500px; height: 25px">
                   <asp:TextBox ID="txtworktime" runat="server">2007-12-12</asp:TextBox></td>
           </tr>
           <tr>
               <td style="width: 72px; height: 25px">
                   <asp:Label ID="Label27" runat="server" Text="海外保険" Width="102px"></asp:Label></td>
               <td style="width: 500px; height: 25px">
                   <asp:DropDownList ID="cobinsurance" runat="server" Width="203px">
                       <asp:ListItem Selected="True">選択して下さい</asp:ListItem>
                       <asp:ListItem>あり</asp:ListItem>
                       <asp:ListItem>なし</asp:ListItem>
                       <asp:ListItem>相談</asp:ListItem>
                   </asp:DropDownList></td>
           </tr>
           <tr>
               <td style="width: 72px; height: 25px">
                   <asp:Label ID="Label28" runat="server" Text="年次報酬" Width="102px"></asp:Label></td>
               <td style="width: 500px; height: 25px">
                   <asp:DropDownList ID="cobsalarytimes" runat="server" Width="201px">
                       <asp:ListItem Selected="True">選択して下さい</asp:ListItem>
                       <asp:ListItem>13ヶ月</asp:ListItem>
                       <asp:ListItem>14ヶ月</asp:ListItem>
                       <asp:ListItem>13ヶ月+賞与</asp:ListItem>
                       <asp:ListItem>14ヶ月+賞与</asp:ListItem>
                   </asp:DropDownList></td>
           </tr>
           <tr>
               <td style="width: 72px; height: 25px">
                   <asp:Label ID="Label29" runat="server" Text="有給休暇" Width="102px"></asp:Label></td>
               <td style="width: 500px; height: 25px">
                   <asp:TextBox ID="txtholidays" runat="server" Width="195px"></asp:TextBox></td>
           </tr>
           <tr>
               <td style="width: 72px; height: 27px">
                   <asp:Label ID="Label30" runat="server" Text="職務内容" Width="99px"></asp:Label></td>
               <td style="width: 500px; height: 27px">
                   <asp:TextBox ID="txtworkContent" runat="server" Rows="5" TextMode="MultiLine" Width="300px">職務内容</asp:TextBox></td>
           </tr>
           <tr>
               <td style="width: 72px; height: 25px">
                   <asp:Label ID="Label31" runat="server" Text="条件"></asp:Label></td>
               <td style="width: 500px; height: 25px">
                   <asp:TextBox ID="txtCondition" runat="server" Rows="5" TextMode="MultiLine" Width="300px">条件</asp:TextBox></td>
           </tr>
           <tr>
               <td style="width: 72px; height: 25px">
                   <asp:Label ID="Label32" runat="server" Text="その他"></asp:Label></td>
               <td style="width: 500px; height: 25px">
                   <asp:TextBox ID="txtother" runat="server" Rows="5" TextMode="MultiLine" Width="300px">その他</asp:TextBox></td>
           </tr>
            <tr>
                <td style="width: 72px; height: 29px;">
                    <asp:Label ID="Label20" runat="server" Text="收件人地址" Width="111px" Visible="False"></asp:Label></td>
                <td style="width: 500px; height: 29px;">
                    <asp:TextBox ID="toemail" runat="server" BorderStyle="Solid" BorderWidth="1px" Visible="False"></asp:TextBox>
                    &nbsp;&nbsp;
                </td>
            </tr>
           <tr>
               <td style="width: 72px; height: 29px">
               </td>
               <td style="width: 500px; height: 29px">
                    <asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="发信" />
                    <asp:Button ID="Button1" runat="server" Text="清空" /></td>
           </tr>
        </table>
    </div>
    </form>
</body>
</html>


 

// CS部份

 

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Net.Mail;
using System.Net;


public partial class jphrorder : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void Button2_Click(object sender, EventArgs e)
    {
        saveOrder();
        sendmail();
     }

    //保存数据
    protected void saveOrder()
    {
        SqlConnection conData;
         // conData = new SqlConnection("Server=121.14.3.78;uid=web71760;pwd=c0k9a4l7;database=www_bluenet_com_cn");
            conData = new SqlConnection("Data Source=CZJ//SQLEXPRESS;Initial Catalog=test;User ID=sa;Password=sa");

        //string sqlstring = "insert into jphrorder(ortime,orcompany,oraddress,orpostal,ortelephone,orfax,orurl,orcount," +
        //                  "orcompanycountry,orconnect,orconnectjob,orcellphone,oremail,orcontent,orjob,orstatus,orcountry,orold," +
        //                  "orplace)"
        //                + "values (@ortime,@orcompany,@oraddress,@orpostal,@ortelephone,@orfax,@orurl,@orcount," +
        //                 "@orcompanycountry,@orconnect,@orconnectjob,@orcellphone,@oremail,@orcontent,@orjob,@orstatus,@orcountry,@orold," +
        //                 "@orplace)";


        string sqlstring = "insert into jphrorder(ortime,orcompany,oraddress,orpostal,ortelephone,orfax,orurl,orcount," +
                  "orcompanycountry,orconnect,orconnectjob,orcellphone,oremail,orcontent,orjob,orstatus,orcountry,"+
                  "orold,orsex,orplace,oreducational,orPcable,orbForeignlanguage,orSalary,orsubsidy,orworktime,orinsurance,orsalarytimes,orholidays,orworkContent,orCondition,other)"
                +"values (@ortime,@orcompany,@oraddress,@orpostal,@ortelephone,@orfax,@orurl,@orcount," +
                 "@orcompanycountry,@orconnect,@orconnectjob,@orcellphone,@oremail,@orcontent,@orjob,@orstatus,@orcountry,"+
                 "@orold,@orsex,@orplace,@oreducational,@orPcable,@orbForeignlanguage,@orSalary,@orsubsidy,@orworktime,@orinsurance,@orsalarytimes,@orholidays,@orworkContent,@orCondition,@other)";
           
       SqlCommand insertCmd = new SqlCommand(sqlstring, conData);       
      
        insertCmd.Parameters.Add("@ortime", SqlDbType.SmallDateTime);
        insertCmd.Parameters.Add("@orcompany",SqlDbType.VarChar,50);
        insertCmd.Parameters.Add("@oraddress", SqlDbType.VarChar,50);
        insertCmd.Parameters.Add("@orpostal", SqlDbType.VarChar, 20);
        insertCmd.Parameters.Add("@ortelephone", SqlDbType.VarChar, 30);
        insertCmd.Parameters.Add("@orfax", SqlDbType.VarChar, 30);
        insertCmd.Parameters.Add("@orurl", SqlDbType.VarChar, 50);
        insertCmd.Parameters.Add("@orcount", SqlDbType.VarChar, 50);
        insertCmd.Parameters.Add("@orcompanycountry", SqlDbType.VarChar, 50);
        insertCmd.Parameters.Add("@orconnect", SqlDbType.VarChar, 50);
        insertCmd.Parameters.Add("@orconnectjob", SqlDbType.VarChar, 50);
        insertCmd.Parameters.Add("@orcellphone", SqlDbType.VarChar, 50);
        insertCmd.Parameters.Add("@oremail", SqlDbType.VarChar, 50);
        insertCmd.Parameters.Add("@orcontent", SqlDbType.VarChar, 300);
        insertCmd.Parameters.Add("@orjob", SqlDbType.VarChar, 50);
        insertCmd.Parameters.Add("@orstatus", SqlDbType.VarChar, 50);
        insertCmd.Parameters.Add("@orcountry", SqlDbType.VarChar, 50);
        insertCmd.Parameters.Add("@orold", SqlDbType.Int);
        insertCmd.Parameters.Add("@orsex", SqlDbType.VarChar,20);
        insertCmd.Parameters.Add("@orplace", SqlDbType.VarChar, 50); 

        //后一部分字段
        insertCmd.Parameters.Add("@oreducational", SqlDbType.VarChar, 50);
        insertCmd.Parameters.Add("@orPcable", SqlDbType.VarChar, 50);
        insertCmd.Parameters.Add("@orbForeignlanguage", SqlDbType.VarChar, 50);
        insertCmd.Parameters.Add("@orSalary", SqlDbType.VarChar, 50);
        insertCmd.Parameters.Add("@orsubsidy", SqlDbType.VarChar, 50);
        insertCmd.Parameters.Add("@orworktime", SqlDbType.VarChar, 50);
        insertCmd.Parameters.Add("@orinsurance", SqlDbType.VarChar, 50);
        insertCmd.Parameters.Add("@orsalarytimes", SqlDbType.VarChar, 50);
        insertCmd.Parameters.Add("@orholidays", SqlDbType.VarChar, 50);
        insertCmd.Parameters.Add("@orworkContent", SqlDbType.VarChar, 50);
        insertCmd.Parameters.Add("@orCondition", SqlDbType.VarChar, 50);
        insertCmd.Parameters.Add("@other", SqlDbType.VarChar, 50);   

        //输入数据
        insertCmd.Parameters["@ortime"].Value = DateTime.Now;
        insertCmd.Parameters["@orcompany"].Value = txtCompany.Text;
        insertCmd.Parameters["@oraddress"].Value = txtaddress.Text;
        insertCmd.Parameters["@orpostal"].Value = txtorpostal.Text;
        insertCmd.Parameters["@ortelephone"].Value = txttelephone.Text;
        insertCmd.Parameters["@orfax"].Value = txtfax.Text;
        insertCmd.Parameters["@orurl"].Value = txturl.Text;
        insertCmd.Parameters["@orcount"].Value = txtcount.Text;
        //选择企业国籍
        string selectCountry = "";
        for (int i = 0; i <= this.cobcountry.Items.Count - 1; i++)
        {
            if (this.cobcountry.Items[i].Selected)
            {
                //Response.Write(this.chkcity.Items[i].Value.ToString() + "-" + this.chkcity.Items[i].Text + "<br>");
                selectCountry += this.cobcountry.Items[i].ToString();
            }
        }
        insertCmd.Parameters["@orcompanycountry"].Value = selectCountry;
        insertCmd.Parameters["@orconnect"].Value = txtconnect.Text;
        insertCmd.Parameters["@orconnectjob"].Value = txtconnectjob.Text;
        insertCmd.Parameters["@orcellphone"].Value = txtcellphone.Text;
        insertCmd.Parameters["@oremail"].Value = txtemail.Text;
        insertCmd.Parameters["@orcontent"].Value = txtContent.Text;
        insertCmd.Parameters["@orjob"].Value = txtjob.Text;
       
        //就业状态
        string selectStatus = "";
        for (int i = 0; i <= this.cobstatus.Items.Count - 1; i++)
        {
            if (this.cobstatus.Items[i].Selected)
            {
                //Response.Write(this.chkcity.Items[i].Value.ToString() + "-" + this.chkcity.Items[i].Text + "<br>");
                selectStatus += this.cobstatus.Items[i].ToString();
            }
        }
        insertCmd.Parameters["@orstatus"].Value = selectStatus;

       
        //人才国籍要求
        string selecthrCountry = "";
        for (int i = 0; i <= this.cobcountry.Items.Count - 1; i++)
        {
            if (this.cobcountry.Items[i].Selected)
            {
                //Response.Write(this.chkcity.Items[i].Value.ToString() + "-" + this.chkcity.Items[i].Text + "<br>");
                selecthrCountry += this.cobcountry.Items[i].ToString();
            }
        }
        insertCmd.Parameters["@orcountry"].Value = selecthrCountry;
        //insertCmd.Parameters["@orcountry"].Value = cobcountry.SelectedValue.ToString();
      
        insertCmd.Parameters["@orold"].Value = int.Parse(txtold.Text);
       
        //姓别
        //string selecthrSex = "";
        //for (int i = 0; i <= this.cobsex.Items.Count - 1; i++)
        //{
        //    if (this.cobsex.Items[i].Selected)
        //    {
        //        //Response.Write(this.chkcity.Items[i].Value.ToString() + "-" + this.chkcity.Items[i].Text + "<br>");
        //        selecthrSex += this.cobsex.Items[i].ToString();
        //    }
        //}
        //insertCmd.Parameters["@orsex"].Value = selecthrSex.ToString();

        insertCmd.Parameters["@orsex"].Value = cobsex.SelectedValue.ToString();            
        insertCmd.Parameters["@orplace"].Value = txtplace.Text;


        //选择学历
        //string selectEducation = "";
        //for (int i = 0; i <= this.cobEducational.Items.Count - 1; i++)
        //{
        //    if (this.cobEducational.Items[i].Selected)
        //    {
        //        //Response.Write(this.chkcity.Items[i].Value.ToString() + "-" + this.chkcity.Items[i].Text + "<br>");
        //        selectEducation += this.cobEducational.Items[i].ToString();
        //    }
        //}        
        //insertCmd.Parameters["@oreducational"].Value = cobEducational.SelectedValue.ToString();

        insertCmd.Parameters["@oreducational"].Value = cobEducational.SelectedValue.ToString();
        insertCmd.Parameters["@orPcable"].Value = txtPcable.Text;
        insertCmd.Parameters["@orbForeignlanguage"].Value = cobForeignlanguage.SelectedValue.ToString();
        insertCmd.Parameters["@orSalary"].Value = txtSalary.Text;
        insertCmd.Parameters["@orsubsidy"].Value = txtsubsidy.Text;
        insertCmd.Parameters["@orworktime"].Value = txtworktime.Text;
        insertCmd.Parameters["@orinsurance"].Value = cobinsurance.SelectedValue.ToString();
        insertCmd.Parameters["@orsalarytimes"].Value = cobsalarytimes.SelectedValue.ToString();
        insertCmd.Parameters["@orholidays"].Value = txtholidays.Text;
        insertCmd.Parameters["@orworkContent"].Value = txtworkContent.Text;
        insertCmd.Parameters["@orCondition"].Value = txtCondition.Text;
        insertCmd.Parameters["@other"].Value = txtother.Text;
    
       // insertCmd.Parameters["@orcontent"].Value = txtContent.Text;         
       // string selectCountry = "";
       // for (int i = 0; i <= this.txtcompanycountry.Items.Count - 1; i++)
       // {
       //     if (this.txtcompanycountry.Items[i].Selected)
       //     {
       //         //Response.Write(this.chkcity.Items[i].Value.ToString() + "-" + this.chkcity.Items[i].Text + "<br>");
       //          selectCountry += this.txtcompanycountry.Items[i].ToString() ;
       //     }
       // }
       // insertCmd.Parameters["@orcountry"].Value = selectCountry;


        try
        {
            conData.Open();
            int flag = insertCmd.ExecuteNonQuery();
            if (flag > 0)
            {
                Response.Write("<script language=javascript>alert('保存成功')</script>");
            }
            else
            {
                Response.Write("<script language=javascript>alert('保存失败')</script>");
            }
        }

        catch(System.Exception ee)
        {
        Response.Write("<script language=javascript>alert('"+ee.Message.ToString()+"')</script>");
        }

        finally
        {
      conData.Close();
        }

        }


    //sendEmail()
    protected void sendmail()
        {
        //MailMessage mm = new MailMessage(emailfrom.Text, emailto.Text);
        MailMessage mm = new MailMessage("czj-wj@163.com", "czj_wj@hotmail1.com");


        mm.Subject = "日本人才求职";

        string body = "发信时间: " + DateTime.Now.ToString() + "/n" +
                "会社名: " + txtCompany.Text + "/n" +
                "会社住所: " + txtaddress.Text + "/n" +
                "郵便番号: " + txtorpostal.Text + "/n" +
                "Fax: " + txtfax.Text  + "/n" +
                "会社URL:" + txturl.Text + "/n" +
                "社員数: " + txtcount.Text + "/n" +
                "企業国籍: " + txtcompanycountry.SelectedValue.ToString() + "/n" +
                "ご担当者: " + txtconnect.Text + "/n" +
                "部署/職位: " + txtconnectjob.Text + "/n" +
                "携帯電話: " + txtcellphone.Text + "/n" +
                "Email: " + txtemail.Text + "/n" +
                "経営内容: " + txtContent.Text + "/n" +

                "職位: " + txtjob.Text + "/n" +
                "職位現状: " + cobstatus.SelectedValue.ToString() + "/n" +
                "国籍: " + cobcountry.SelectedValue.ToString() + "/n" +
                "年齢: " + txtold.Text + "/n" +
                "性別: " + cobsex.SelectedValue.ToString() + "/n" +

                "勤務地: " + txtplace.Text + "/n" +
                "学歴: " + cobEducational.SelectedValue.ToString() + "/n" +
                "PCレベル: " + txtPcable.Text + "/n" +
                 "外国語: " + cobForeignlanguage.SelectedValue.ToString() + "/n" +
                  "月給: " + txtSalary.Text + "/n" +
                 "手当て: " + txtsubsidy.Text + "/n" +
                 "勤務時間: " + txtworktime.Text + "/n" +
                 "海外保険: " + cobinsurance.SelectedValue.ToString() + "/n" +
                 "年次報酬: " + cobsalarytimes.SelectedValue.ToString() + "/n" +
                 "有給休暇: " + txtholidays.Text + "/n" +
                 "職務内容: " + txtworkContent.Text + "/n" +
                 "条件: " + txtCondition.Text + "/n" +
                 "その他: " + txtother.Text + "/n" ;      
           
        mm.Body = body;
        SmtpClient sc = new SmtpClient();

        // 编程方式设置smtp(不用web.config)
         //sc.Host = "vipmail-g1.xinnetdns.com";
         //sc.Host = "bf-vipmail-g1.xinnetdns.com";
         sc.Host = "smtp.163.com";      
         sc.Port = 25;
         sc.Credentials = new NetworkCredential("czj-wj@163.com", " 此处是Smtp邮箱密码");

        try
        {
            sc.Send(mm);
            Response.Write(" ");
        }
        catch (Exception ex)
        {
            // 与smtp相关的错误
            if (ex is SmtpException)
            {
                // ex.ToString();
                Response.Write("smtp发信失败");
            }
            else
            {
                Response.Write(ex.ToString());
            }
        }
   
               }

 

  
}

 

 

//  数据库代码

/****** 对象:  Table [dbo].[jphrorder]    脚本日期: 08/19/2008 11:33:14 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[jphrorder](
 [orderId] [int] IDENTITY(1,1) NOT NULL,
 [ortime] [smalldatetime] NULL,
 [orcompany] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
 [oraddress] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
 [orpostal] [varchar](20) COLLATE Chinese_PRC_CI_AS NULL,
 [ortelephone] [varchar](30) COLLATE Chinese_PRC_CI_AS NULL,
 [orfax] [varchar](30) COLLATE Chinese_PRC_CI_AS NULL,
 [orurl] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
 [orcount] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
 [orcompanycountry] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
 [orconnect] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
 [orconnectjob] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
 [orcellphone] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
 [oremail] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
 [orcontent] [varchar](300) COLLATE Chinese_PRC_CI_AS NULL,
 [orjob] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
 [orstatus] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
 [orcountry] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
 [orold] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
 [orsex] [varchar](20) COLLATE Chinese_PRC_CI_AS NULL,
 [orplace] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
 [oreducational] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
 [orPcable] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
 [orbForeignlanguage] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
 [orSalary] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
 [orsubsidy] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
 [orworktime] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
 [orinsurance] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
 [orsalarytimes] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
 [orholidays] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
 [orworkContent] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
 [orCondition] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
 [other] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
 CONSTRAINT [PK_jphrorder] PRIMARY KEY CLUSTERED
(
 [orderId] ASC
) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF

select * from jphrorder

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值