小编ank*_*ung的帖子

运行计划任务的最佳方式

今天我们构建了一个控制台应用程序,用于运行ASP.NET网站的计划任务.但我认为这种方法有点容易出错且难以维护.如何执行计划任务(在Windows/IIS/ASP.NET环境中)

更新:

任务示例:

  • 从数据库中的电子邮件队列发送电子邮件
  • 从数据库中删除过时的对象
  • 从Google AdWords检索统计信息并填写数据库中的表格.

windows asp.net iis scheduled-tasks

225
推荐指数
6
解决办法
19万
查看次数

验证我的表格

我是新手.Net Framework,我想在我的Windows窗体应用程序中添加验证Visual Studio 2010 IDE.我已经搜索了不同的方法,但我不确定在哪里可以添加我的表单中的代码?其中一个例子是下面的代码.

我是否在表单加载方法或提交按钮或其他位置添加此代码?

using System;
using System.Data.Entity;
using System.ComponentModel.DataAnnotations;

namespace MvcMovie.Models
{
    public class Movie
    {
        public int ID { get; set; }

        [Required(ErrorMessage = "Title is required")]
        public string Title { get; set; }

        [Required(ErrorMessage = "Date is required")]
        public DateTime ReleaseDate { get; set; }

        [Required(ErrorMessage = "Genre must be specified")]
        public string Genre { get; set; }

        [Required(ErrorMessage = "Price Required")]
        [Range(1, 100, ErrorMessage = "Price must be between $1 …
Run Code Online (Sandbox Code Playgroud)

.net c# textbox winforms

5
推荐指数
1
解决办法
302
查看次数

数据类型text和varchar在equal运算符中不兼容

我试图在数据网格视图上访问数据库中的所有记录,具体取决于通过具有2个用于user_name和密码的文本框的表单登录的用户类型,并显示提交按钮记录.但是我编写的代码给出了以下错误:数据类型text和varchar在等于运算符中是不兼容的.请提出修改建议.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Configuration;
using System.Data.SqlClient;


namespace Login_form
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {



        }

        private void button1_Click(object sender, EventArgs e)
        {

            string str = ConfigurationSettings.AppSettings["constring"].ToString();
            SqlConnection sqlcon = new SqlConnection(str);


            try
            {
                sqlcon.Open();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }


            SqlCommand sqlcmd = new SqlCommand("select user_type from employee where user_name='" …
Run Code Online (Sandbox Code Playgroud)

c# database sqldatareader winforms

4
推荐指数
1
解决办法
1万
查看次数

将列表框的选定项目显示在消息框中

我可以在列表框中将多个选定项目显示在按钮单击的文本框中,但如何在消息框中显示相同的内容?我的意思是在消息框上显示第一项不是问题,而是同时显示多个项目.建议请......

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace cities
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            textBox1.Clear();
            foreach (object selectedItem in listBox1.SelectedItems)
            {
               textBox1.AppendText(selectedItem.ToString() + Environment.NewLine);
            }


        }

        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }
    }
}
Run Code Online (Sandbox Code Playgroud)

.net c# listbox messagebox

1
推荐指数
1
解决办法
9249
查看次数

在jquery中将get方法设置为div失败

我想将div的文本设置为"not found",以防脚本无法获取脚本中的url.我正在使用jQuery 1.4版本,我必须继续使用它出于某种原因.有人能提出一些好主意吗?

JavaScript的

$(document).ready(function () {
    $("#slides").html("");
    $.get('someURl',

    function (d) {
        var i = 0;
        var array = [];
        var anchorImg = '';
        $(d).find('entry').each(function () {
            anchorImg = "<img id='imageID" + i + "' width='480' height='380'/>"
            $("#slides").append(anchorImg);
            var $entry = $(this);
            var pic = $entry.find('content').attr('src');
            array[i] = pic;
            var ankita = "imageID" + i;
            document.getElementById(ankita).src = array[i];
            i++;
        });

    });

});
Run Code Online (Sandbox Code Playgroud)

javascript jquery

0
推荐指数
1
解决办法
94
查看次数