我有一个包含几个文本框的表单,您在文本框中输入一些值,然后在按下提交时将值保存到文件中.但是,当我按提交时,我得到以下异常.
System.Configuration.ConfigurationErrorsException: Configuration system failed to initialize ---> System.Configuration.ConfigurationErrorsException: Unrecognized configuration section add. (C:\Program Files (x86)\Default Company Name\Setup\HomeInventory2.exe.Config line 3)
at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)
at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors)
at System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors()
at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)
--- End of inner exception stack trace ---
at HomeInventory2.Services.Factory.GetService(String servicename) in C:\Users\Protego\documents\visual studio 2010\Projects\HomeInventory2\HomeInventory2\Services\Factory.cs:line 37
at HomeInventory2.Business.Manager.GetService(String name) in C:\Users\Protego\documents\visual studio 2010\Projects\HomeInventory2\HomeInventory2\Business\Manager.cs:line 14
at HomeInventory2.Business.InventoryMngr.Create(CreateInventory inv) in C:\Users\Protego\documents\visual studio 2010\Projects\HomeInventory2\HomeInventory2\Business\InventoryMngr.cs:line 19
at HomeInventory2.Form1.submitButton_Click(Object sender, EventArgs e) in C:\Users\Protego\documents\visual studio 2010\Projects\HomeInventory2\HomeInventory2\Form1.cs:line 52
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at …Run Code Online (Sandbox Code Playgroud) 我试图弄清楚是否可以设置一个cron作业,将所有文件从我的服务器上的一个文件夹传输到另一个文件夹,然后从另一个文件夹中取出一定数量的文件(随机选择的文件)并将其放入原始文件夹.如果有任何关于如何做到的提示,我根本没有使用cron的经验,我只是不想用ftp登录并手动进行传输.
这个页面有一个传递给它的变量(aucname2),然后它应该使用它作为sql语句的值.但它一直告诉我,值被用作列,然后当然告诉我列不存在
<?php
$auc = $_GET['aucname2'];
$db_name = "auctionfinal";
$table_name = "auctions";
$connection = @mysql_connect("auctionfinal.db.6084638.hostedresource.com","xxxxx", "xxxxx") or die(mysql_error());
$db = @mysql_select_db($db_name, $connection) or die(mysql_error());
$sql = "SELECT * FROM $table_name WHERE `aucname` = $auc";
$result = @mysql_query($sql, $connection) or die(mysql_error());
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_array($result)) {
$aucname3 = $row['aucname'];
$seller = $row['seller'];
$price = $row['price'];
$start = $row['start'];
$end = $row['end'];
$nbids = $row['nbids'];
$category = $row['category'];
$link = "pagename.php?aucname=$aucname";
$display_block = "Auction Name - $aucname3 …Run Code Online (Sandbox Code Playgroud) 我是JUnit测试的新手,我正在尝试测试以下非常简单的类
public interface IItemsService extends IService {
public final String NAME = "IItemsService";
/** Places items into the database
* @return
* @throws ItemNotStoredException
*/
public boolean storeItem(Items items) throws ItemNotStoredException;
/** Retrieves items from the database
*
* @param category
* @param amount
* @param color
* @param type
* @return
* @throws ItemNotFoundException
*/
public Items getItems (String category, float amount, String color, String type) throws ItemNotFoundException;
}
Run Code Online (Sandbox Code Playgroud)
这是我的测试,但我一直得到空指针,另一个错误,它不适用于参数...显然我做了一些愚蠢但我没有看到它.有人能指出我正确的方向吗?
public class ItemsServiceTest extends TestCase {
/**
* @throws …Run Code Online (Sandbox Code Playgroud) 我不断收到这个错误,我不确定我做错了什么.错误1'Home.Services.InventoryImpl'未实现接口成员'Home.Services.InventorySvc.CreateInventory(Home.Services.InventoryImpl)'
我的接口代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Home;
using Home.Domain;
namespace Home.Services
{
public interface InventorySvc
{
void CreateInventory(InventoryImpl CreateTheInventory);
}
}
Run Code Online (Sandbox Code Playgroud)
我的实施准则
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Home.Domain;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
namespace Home.Services
{
public class InventoryImpl: InventorySvc
{
public void CreateTheInventory(CreateInventory createinventory)
{
FileStream fileStream = new FileStream
("CreateInventory.bin", FileMode.Create,
FileAccess.Write);
IFormatter formatter = new BinaryFormatter();
formatter.Serialize(fileStream, createinventory);
fileStream.Close();
}
}
}
Run Code Online (Sandbox Code Playgroud)