问题列表 - 第24148页

类库中app.config中的连接字符串

我正在创建解决方案,我在内部有三个项目:

  1. WCF服务库项目

  2. DataAccess项目(类库)

  3. 用于托管WCF服务的网站

该服务的实现在项目#1上,但是为了访问DataBase,我使用第二个项目,该项目使用类库项目实现数据访问.

这个问题是为了获得数据访问我需要配置一个连接字符串,但该连接字符串必须在生产环境中可配置,我的意思是在生产中我将部署该站点,这是一个非常简单的项目,只包含参考WCF服务库项目然后来自数据库部门的人将配置连接字符串.

在开发中,我在数据访问项目上有一个app.config,但是当我发布时,app.config嵌入在dll中.

任何想法我们如何才能实现我们的目标

wcf c#-3.0

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

数据库拉线程序期间的Heroku问题应用程序:Mysql ::错误MySQL服务器已经消失

尝试从Heroku中提取数据库会在整个过程中产生错误(如下所示).

使用:雪豹; Heroku的-1.8.2; 水龙头-0.2.26; Rails的2.3.5; MYSQL-42年5月1日.从错误消息中可以看出,数据库很小.

Heroku技术支持说它在我的系统上是一个问题,但没有提供如何解决它的方法.

我之前见过这个问题 - 例如这里.我怎样才能解决这个问题?

错误:

$ heroku db:pull
Auto-detected local database: mysql://[...]@localhost/[...]?encoding=utf8
Receiving schema
Receiving data
17 tables, 9,609 records
[...]
/Library/Ruby/Gems/1.8/gems/sequel-3.0.0/lib/sequel/adapters/mysql.rb:166:in `query': Mysql::Error MySQL server has gone away (Sequel::DatabaseError)
    from /Library/Ruby/Gems/1.8/gems/sequel-3.0.0/lib/sequel/adapters/mysql.rb:166:in `_execute'
    from /Library/Ruby/Gems/1.8/gems/sequel-3.0.0/lib/sequel/adapters/mysql.rb:125:in `execute'
    from /Library/Ruby/Gems/1.8/gems/sequel-3.0.0/lib/sequel/connection_pool.rb:101:in `hold'
    from /Library/Ruby/Gems/1.8/gems/sequel-3.0.0/lib/sequel/database.rb:461:in `synchronize'
    from /Library/Ruby/Gems/1.8/gems/sequel-3.0.0/lib/sequel/adapters/mysql.rb:125:in `execute'
    from /Library/Ruby/Gems/1.8/gems/sequel-3.0.0/lib/sequel/database.rb:296:in `execute_dui'
    from /Library/Ruby/Gems/1.8/gems/sequel-3.0.0/lib/sequel/dataset.rb:276:in `execute_dui'
    from /Library/Ruby/Gems/1.8/gems/sequel-3.0.0/lib/sequel/adapters/mysql.rb:365:in `execute_dui'
    from /Library/Ruby/Gems/1.8/gems/sequel-3.0.0/lib/sequel/dataset/convenience.rb:126:in `import'
    from /Library/Ruby/Gems/1.8/gems/sequel-3.0.0/lib/sequel/dataset/convenience.rb:126:in `each'
    from /Library/Ruby/Gems/1.8/gems/sequel-3.0.0/lib/sequel/dataset/convenience.rb:126:in `import'
    from /Library/Ruby/Gems/1.8/gems/sequel-3.0.0/lib/sequel/adapters/mysql.rb:144:in `transaction'
    from /Library/Ruby/Gems/1.8/gems/sequel-3.0.0/lib/sequel/connection_pool.rb:108:in `hold'
    from /Library/Ruby/Gems/1.8/gems/sequel-3.0.0/lib/sequel/database.rb:461:in `synchronize' …
Run Code Online (Sandbox Code Playgroud)

ruby mysql ruby-on-rails heroku sequel

6
推荐指数
2
解决办法
1789
查看次数

SSIS 2005 - 如何检查文件以查看文件是否不存在

如何检查SQL Server Integration Services 2005中是否存在文件?

是否有本机SSIS组件可以为您执行此操作?

ssis

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

如何填写C#comboBox中的空格作为用户的提示?

当动态填充C#中的comboBox时,comboBox将显示为空白,直到用户单击它以查看下拉列表中的可用项目为止.理想情况下,我想使用此空白区域(在单击下拉列表之前)用于向用户提供有关他/她应该做什么的提示.例如,它可能会说"选择这样的......"有没有办法做到这一点?我尝试设置Text属性,但是没有做任何事情.我使用的是Microsoft Visual C#2008 Express Edition.谢谢.

c# combobox

2
推荐指数
2
解决办法
4149
查看次数

CSS:如何引用标签

我知道怎么tag用a idclassin 来引用acss

 <table id="cooltable">
      <tr>
          <td></td>
          <td></td>
      </tr>
 </table>
Run Code Online (Sandbox Code Playgroud)

所以css,你这<table>是指

 table#cooltable{
     ...
 }
Run Code Online (Sandbox Code Playgroud)

但是,如果我想引用了<td><table>CSS中,我该怎么办呢?

html css tags

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

从生成的AutoCompleteTextView $ DropDownListView获取有关AutocompleteTextView的信息

我正在使用3个AutocompleteTextViews来建议数据库中的条目.我将AutocompleteTextView子类化,以便在单击时将默认文本设置为null,如果移开则设置回默认指令并且不输入任何内容.

我使用SimpleCursorAdapter绑定到视图,但我发现我无法从OnItemClickListener获取AutocompleteTextView的id,我需要在变量中的所选行中添加其他信息,具体取决于AutocompleteTextView来自.我可以访问的只是AutoCompleteTextView $ DropDownListView,它是一个未记录的内部类,似乎没有提供真正的功能.也没有办法上升视图层次结构来获取原始的AutocompleteTextView.

因此,我将SimpleCursorAdapter子类化,并在构造函数中添加了一个int,以识别适配器来自哪个AutocompleteTextView,并且我能够从传递给OnItemClick()的视图中访问它.所以,虽然我的解决方案工作正常,但我想知道是否有可能从DropDownListView获取AutocompleteTextView的id?

我还使用另一个数据库查询从OnItemClick获取id,然后查找该项的数据,因为我找不到将多个列转换为字符串的方法.我应该使用CursorAdapter来保存启动另一个查询吗?哦,另外一件事,我最初需要一个数据库游标(all_cursor),当我正在做的就是过滤它以获得一个新游标?似乎有点矫枉过正.

活动....

    dbse.openDataBase();
    Cursor all_Cursor = dbse.autocomplete_query();
    startManagingCursor(all_Cursor);
    String[] from_all = new String[]{DbAdapter.KEY_NAME};
    int[] to_all = new int[] {android.R.id.text1};
    from_adapt = new AutocompleteAdapter(FROM_DBADAPTER, this,android.R.layout.simple_dropdown_item_1line, all_Cursor, from_all, to_all);
    from_adapt.setStringConversionColumn(1);
    from_adapt.setFilterQueryProvider(this);
    to_adapt = new AutocompleteAdapter(TO_DBADAPTER, this,android.R.layout.simple_dropdown_item_1line, all_Cursor, from_all, to_all);
    to_adapt.setStringConversionColumn(1);
    to_adapt.setFilterQueryProvider(this);   
from_auto_complete = (Autocomplete) findViewById(R.id.entry_from);
from_auto_complete.setAdapter(from_adapt);
from_auto_complete.setOnItemClickListener(this);

to_auto_complete = (Autocomplete) findViewById(R.id.entry_to);
to_auto_complete.setAdapter(to_adapt);
to_auto_complete.setOnItemClickListener(this);

public void onItemClick (AdapterView<?> parent, View view, int position, long id) {
    Cursor selected_row_cursor = dbse.data_from_id(id);
    selected_row_cursor.moveToFirst();
    String lat = selected_row_cursor.getString(1);
    String lon = …
Run Code Online (Sandbox Code Playgroud)

android

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

如何在python中对swig矩阵对象进行stringfy

我正在使用openbabel的 swig包装器(用C++编写,并通过swig提供python包装器)

下面我只是用它来读取分子结构文件并获得它的unitcell属性.

import pybel
for molecule in pybel.readfile('pdb','./test.pdb'):
    unitcell = molecule.unitcell
    print unitcell
   |..>     
   |..>     
<openbabel.OBUnitCell; proxy of <Swig Object of type 'OpenBabel::OBUnitCell *' at 0x17b390c0> >
Run Code Online (Sandbox Code Playgroud)

unitcell具有CellMatrix()功能,

unitcell.GetCellMatrix()
   <22> <openbabel.matrix3x3; proxy of <Swig Object of type 'OpenBabel::matrix3x3 *' at 0x17b3ecf0> >
Run Code Online (Sandbox Code Playgroud)

OpenBabel :: matrix3x3是这样的:

1 2 3
4 5 6
7 8 9
Run Code Online (Sandbox Code Playgroud)

我想知道如何打印矩阵3*3的内容.我曾尝试__str____repr__它.

在python中使用swing包装的矩阵的内容的任何一般方法?

谢谢

python swig

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

如何将外键约束放在sql server中的计算字段上?

表A有一个名为Computed1的计算字段.它persisted不是空的.此外,它总是计算一个char(50)的表达式.它也是独一无二的,并且有一个独特的键约束.

表B有一个字段RefersToComputed1,它应该引用一个有效的Computed1值.

尝试在引用A'Computed1的B的RefersToComputed1上创建外键约束会导致以下错误:

Error SQL01268: .Net SqlClient Data Provider: Msg 1753, Level 16, State 0, Line 1 Column
'B.RefersToComputed1' is not the same length or scale as referencing column 'A.Computed1' in
foreign key 'FK_B_A'. Columns participating in a foreign key relationship must be defined with
the same length and scale.
Run Code Online (Sandbox Code Playgroud)

问:为什么会出现此错误?计算列的外键是否需要特殊措施,如果是,它们是什么?


摘要:

  • 特定的问题从计算的,基于char的字段变为varchar.因此,Computed1是varchar(50)而不是char(50).
  • 最好围绕计算字段的表达式进行强制转换,以强制它转换为特定类型.感谢Cade Roux的这个提示.

t-sql sql-server foreign-keys calculated-columns sql-server-2008

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

从完整文件路径中查找文件名

有没有办法从文件完整路径(文件路径的一部分)中提取文件名而不用操纵字符串的麻烦?

Java中的等价物是:

File f = new File ("C:/some_dir/a")
f.getName() //output a
f.getFullAbsolutePath() //output c:/some_dir/a
Run Code Online (Sandbox Code Playgroud)

r file path

143
推荐指数
2
解决办法
7万
查看次数

C++:字符串和联合

我有一个(设计)问题:我正在构建一个解释器,我需要一些存储变量.这里的变量基本上有两种类型的内容:string或者int.

我正在为变量使用一个简单的类,然后所有变量都存储在一个向量中.

但是,由于变量可以包含数字或字符串,因此我不希望C++同时分配和消耗内存.

这就是我想使用工会的原因:

union
{
 string StringValue;
 int IntValue;
}
Run Code Online (Sandbox Code Playgroud)

但是,字符串不适用于工会.

  • 有没有解决方法所以没有任何记忆被无缘无故地吃掉?

c++

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