小编Ant*_*ton的帖子

PostgreSQL函数用于最后插入的ID

在PostgreSQL中,如何将最后一个id插入表中?

在MS SQL中有SCOPE_IDENTITY().

请不要建议我使用这样的东西:

select max(id) from table
Run Code Online (Sandbox Code Playgroud)

postgresql insert lastinsertid

297
推荐指数
10
解决办法
23万
查看次数

用于"Ctrl"/"Shift"+鼠标左键单击的JavaScript或jQuery事件处理程序

是否可以处理以下事件:

  • Ctrl +鼠标左键单击;
  • Shift +鼠标左键单击;
  • Alt+鼠标左键单击使用JavaScript,jQuery或其他框架.

如果可能,请给出一个代码示例.

javascript jquery events

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

PostgreSQL字符长度限制

我在PostgreSQL中使用字符变化数据类型.我无法在PostgreSQL手册中找到这些信息.字符变化数据类型中字符的最大限制是多少?

database postgresql

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

如何添加可在Visual Studio中访问的自定义数据库提供程序?

我想在Visual Studio中使用自定义数据库提供程序.我需要它来使用实体框架.

例如,我下载了NpgSQL,在GAC中注册了它们:

gacutil  -i  c:\temp\npgsql.dll
gacutil  -i  c:\temp\mono.security.dll
Run Code Online (Sandbox Code Playgroud)

并添加到machine.config文件:

<add name="Npgsql Data Provider"
invariant="Npgsql"  support="FF"
description=".Net Framework Data Provider for Postgresql Server"
type="Npgsql.NpgsqlFactory, Npgsql, Version=2.0.6.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7" />
Run Code Online (Sandbox Code Playgroud)

但是Npgsql没有出现在Visual Studio的数据源列表中:

VS中的数据源

如何将自定义数据库提供程序添加到此列表?

UPD:如果我使用命令字符串edmgen.exe我得到错误:

错误7001:无法找到或加载已注册的.Net Framework数据提供程序.

postgresql npgsql visual-studio dbproviderfactories

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

ASP.NET用户控件中的Javascript函数

我用javascript函数创建了ASP.NET用户控件:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TestControl.ascx.cs" Inherits="BingTranslator.Web.WebUserControl1" %>
<script type="text/javascript">
    function example() {
        alert('<%=ExampleButton.ClientID%>');
        return false;
    }
</script>
<asp:Button ID="ExampleButton" runat="server" Text="Example"/>
Run Code Online (Sandbox Code Playgroud)

当用户将鼠标移动到按钮时,我想调用"example"函数,所以我为按钮添加了属性:

ExampleButton.Attributes.Add("onmouseover", "example()");
Run Code Online (Sandbox Code Playgroud)

它运作良好,但当我在同一页面上需要两个控件时,我遇到了问题.ASP.NET生成具有两个具有相同名称的函数的代码,这是错误的:

<script type="text/javascript">
    function example() {
        alert('TestControl1_ExampleButton');
        return false;
    }
</script>
<input type="submit" name="TestControl1$ExampleButton" value="Example" id="TestControl1_ExampleButton" onmouseover="example()" />


<script type="text/javascript">
    function example() {
        alert('TestControl2_ExampleButton');
        return false;
    }
</script>
<input type="submit" name="TestControl2$ExampleButton" value="Example" id="TestControl2_ExampleButton" onmouseover="example()" />
Run Code Online (Sandbox Code Playgroud)

并且任何按钮上的onmouseover事件总是会调用第二个函数.我可以通过将带有客户端ID的java脚本代码直接添加到attriburte onmouseover来解决此问题.

ExampleButton.Attributes.Add("onmouseover", "[Here will be javascript code]");
Run Code Online (Sandbox Code Playgroud)

但对我来说这不是一个非常和谐的解决方案.请告知,我如何才能更好地解决此类问题.

PS会有更多的Javascript代码,例如我添加了两个字符串upper.

javascript c# asp.net user-controls webforms

12
推荐指数
3
解决办法
5万
查看次数

Jquery返回值

我用了一个代码:

jQuery.fn.MyFunction = function(){
return this.each(function() {
    attributes = "test";

    return attributes;
});}
Run Code Online (Sandbox Code Playgroud)

但是当我打电话时

 var1 = $(this).MyFunction();alert(var1);
Run Code Online (Sandbox Code Playgroud)

我有一个[对象],但不是"测试".

如何让jquery插件返回一些值?

javascript jquery

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

Windows表单应用程序异常

我得到应用程序异常

   at System.Windows.Forms.CurrencyManager.get_Item(Int32 index)
   at System.Windows.Forms.CurrencyManager.get_Current()
   at System.Windows.Forms.DataGridView.DataGridViewDataConnection.OnRowEnter(DataGridViewCellEventArgs e)
   at System.Windows.Forms.DataGridView.OnRowEnter(DataGridViewCell& dataGridViewCell, Int32 columnIndex, Int32 rowIndex, Boolean canCreateNewRow, Boolean validationFailureOccurred)
   at System.Windows.Forms.DataGridView.SetCurrentCellAddressCore(Int32 columnIndex, Int32 rowIndex, Boolean setAnchorCellAddress, Boolean validateCurrentCell, Boolean throughMouseClick)
   at System.Windows.Forms.DataGridView.OnCellMouseDown(HitTestInfo hti, Boolean isShiftDown, Boolean isControlDown)
   at System.Windows.Forms.DataGridView.OnCellMouseDown(DataGridViewCellMouseEventArgs e)
   at System.Windows.Forms.DataGridView.OnMouseDown(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.DataGridView.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, …
Run Code Online (Sandbox Code Playgroud)

c# sql entity-framework datagridview winforms

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

3个变量的总和:奇怪的行为

可能重复:
JavaScript的数学是否被破坏?
为什么十进制数不能用二进制表示?

下一个代码的结果是什么:

if(0.3 == ( 0.1 + 0.1 + 0.1 ))
{
      alert(true);
}
else
{
      alert(false);
}
Run Code Online (Sandbox Code Playgroud)

这很奇怪,但结果将是错误的.

原因是结果

0.1 + 0.1 + 0.1

将会

0.30000000000000004

怎么能解释这种行为?

javascript algorithm floating-point binary sum

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

.Net应用程序设置路径

默认情况下,Windows应用程序设置保存在此目录中:

%USERPROFILE%\Local Settings\Application Data\<Company Name>\<appdomainname>_<eid>_<hash>\<version>\user.config
Run Code Online (Sandbox Code Playgroud)

是否可以更改保存user.config文件的路径?例如,将其保存在本地文件夹中?

.net settings

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

如何快速刷新ADO.NET实体数据模型?

我在C#项目中使用ADO.NET实体数据模型。我的项目中的数据库上生成了一个ADO.NET实体数据模型。如何基于数据库更改快速刷新ADO.NET实体数据模型?我一直在删除模型,然后创建一个新模型。我相信,有一种更简单快捷的方法。

c# sql ado.net entity-framework

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