⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 reportdb.cs

📁 《ASP.NET 2.0 XML 高级编程(第3版)》 《ASP.NET 2.0 XML 高级编程(第3版)》
💻 CS
字号:
using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Text;
using System.Web.Configuration;

namespace ShoppingAssistantLib
{
	public class ReportDB
	{		
		/// <summary>
		/// Saves the information contained in the ReportInfo object into the database
		/// </summary>
		/// <param name="report">ReportInfo object</param>
		/// <returns></returns>
		public bool InsertReportInfo(ReportInfo report)
		{
			string connString = WebConfigurationManager.ConnectionStrings["shoppersInfo"].ConnectionString;
			using (SqlConnection conn = new SqlConnection(connString))			
			{							
				conn.Open();				
				SqlCommand command = new SqlCommand("InsertReportInfo", conn);
				command.CommandType = CommandType.StoredProcedure;
				//Add all the parameters
				command.Parameters.Add(new SqlParameter("@ProductID", SqlDbType.Int));
				command.Parameters["@ProductID"].Value = report.ProductID;
				command.Parameters.Add(new SqlParameter("@CategoryID", SqlDbType.Int));
				command.Parameters["@CategoryID"].Value = report.CategoryID;
				command.Parameters.Add(new SqlParameter("@Browser", SqlDbType.VarChar, 256));
				command.Parameters["@Browser"].Value = report.Browser;
				command.Parameters.Add(new SqlParameter("@RequestType", SqlDbType.VarChar, 256));
				command.Parameters["@RequestType"].Value = report.RequestType;
				command.Parameters.Add(new SqlParameter("@Authenticated", SqlDbType.VarChar, 50));
				command.Parameters["@Authenticated"].Value = report.Authenticated;				
				command.ExecuteNonQuery();
				return true;									
			}
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -