Designer文件被锁定,当转到项目属性时,它会出现此错误.
尝试加载项目属性窗口时发生错误.关闭窗口,然后重试.LicenseManager的CurrentContext属性当前已锁定,无法更改.
.net framework 3.5 VS 2008
我需要在一小时内从同一客户那里获得前1名记录.如果在一小时后插入记录,则不需要该记录.请参阅下表.这只是1000个记录的样本.我正在使用SQL Server 2005.
替代文字http://img651.imageshack.us/img651/3990/customershavingmultiple.png
+39 235 6595750
19874624611
+44 (0)181 446 5697
+431 6078115-2730
+1 617 358 5128
+48.40.23755432
+44 1691 872 410
07825 893217
0138 988 1649
(415) 706 2001
00 44 (0) 20 7660 4650
(765) 959-1504
07731 508 486
please reply by email
dont have one
+447769146971
Run Code Online (Sandbox Code Playgroud)
请看上面给出的电话号码.我需要从这些数字中替换所有空格,连字符,句点,括号和前导0等.我需要这种格式+447469186974
如果数字有前导加号,那么不要替换它,否则我必须连接+符号.
例如
+39 235 6595750在这个数字我只需要删除空格.
+44(0)181 446 5697在这个我需要删除空格和括号和0之间的括号,即(0)
07825 893217在此我需要用+号替换前导0并删除空格
(415)706 2001在此替换'('带+符号并删除')'和空格.
'请通过电子邮件回复'这是电话号码字段中的条目,我只需要忽略它.
+48.40.23755432删除电话号码的句点
(765)959-1504删除括号和空格以及连字符,并在数字前添加+号.
7798724250只需要在数字前添加+号
00 44(0)20 7660-4650需要删除前导0 IE'00 '删除空格和括号,并在括号和连字符之间删除0并在数字前添加+号
只有前导'0'才会被替换为'0'的任何其他内容
期望的结果是+447769146971 …
这对我来说有点奇怪.我有脚本如下
DECLARE @maxCustId INT
SELECT @maxCustId = MAX(CustomerId) FROM Customers
SELECT * INTO #temp FROM linkserver.DB.dbo.Customers where CustomerId > @maxCustId
-- Copy records to local db Custome table
DROP TABLE #temp
Run Code Online (Sandbox Code Playgroud)
但有时#temp不会从链接服务器获取所有记录.
就像我Max CustomerId = 1138在我的本地数据库中一样,当我在脚本上运行时,我的临时表(从链接服务器获取记录)未命中CustoemrIds 1140, 1141.链接服务器有customers upto 1160.#temp表有记录,upto 1160但错过了两个记录,即1140, 1141
我一次又一次地运行该脚本,并在第4次尝试1141在#temp表中添加的记录,但记录1140仍然缺失.
然后我在本地服务器上进行以下查询以检查链接服务器中的记录
SELECT * FROM linkserver.DB.dbo.Customers where CustomerId = 1140
Run Code Online (Sandbox Code Playgroud)
上面的查询返回没有记录.
为了验证这一点,我去了链接服务器并在我创建LINKED服务器的服务器上写了相同的查询.
-- This is the server which I am using as linked …Run Code Online (Sandbox Code Playgroud) 嗨,我有一个表客户.表中的一列是DateCreated.此列是NOT NULL但在db中为此列定义了默认值.
当我Customer从我的代码中使用EF4 添加新内容时.
var customer = new Customer();
customer.CustomerName = "Hello";
customer.Email = "hello@ello.com";
// Watch out commented out.
//customer.DateCreated = DateTime.Now;
context.AddToCustomers(customer);
context.SaveChanges();
Run Code Online (Sandbox Code Playgroud)
上面的代码生成以下查询.
exec sp_executesql N'insert [dbo].[Customers]([CustomerName],
[Email], [Phone], [DateCreated], [DateUpdated])
values (@0, @1, null, @2, null)
select [CustomerId]
from [dbo].[Customers]
where @@ROWCOUNT > 0 and [CustomerId] = scope_identity()
',N'@0 varchar(100),@1 varchar(100),@2 datetime2(7)
',@0='Hello',@1='hello@ello.com',@2='0001-01-01 00:00:00'
Run Code Online (Sandbox Code Playgroud)
并抛出错误
The conversion of a datetime2 data type to a datetime data type resulted in an …Run Code Online (Sandbox Code Playgroud) 我有一个用户控件,只要用户点击按钮,我就会在页面上添加.以下是添加控件的代码.
protected void Page_Init(object sender, EventArgs e)
{
if (Session["ControlCount"] != null)
{
for (int i = 1; i <= (int)Session["ControlCount"]; i++)
{
Control myUserControl = LoadControl("~/Controls/MessageControl.ascx");
divMessageControl.Controls.Add(myUserControl);
}
}
}
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnExpand_Click(object sender, EventArgs e)
{
int count = 0;
if (Session["ControlCount"] != null)
{
count = Convert.ToInt32(Session["ControlCount"]);
}
Control myUserControl = (Control)Page.LoadControl("~/Controls/MessageControl.ascx");
divMessageControl.Controls.Add(myUserControl);
Session["ControlCount"] = count + 1;
}
Run Code Online (Sandbox Code Playgroud)
此控件具有ModalPopupExtender弹出窗口.当我在页面上添加第二个控件时,它会在内部抛出一个错误,我可以在firebug中看到.如何使这个弹出窗口ID独一无二?
<asp:ModalPopupExtender ID="mpeReply" BehaviorID="mpeReply" runat="server" TargetControlID="btnReply"
PopupControlID="pnlReply" BackgroundCssClass="ModalPopupBG1">
</asp:ModalPopupExtender>
Run Code Online (Sandbox Code Playgroud)
Sys.InvalidOperationException:Sys.InvalidOperationException:无法将具有相同ID"mpeReply"的两个组件添加到应用程序中.
我正在开发一个评论平台,用户可以发表评论,其他用户可以回复评论.但这些评论可以在两个方向回复(回复和扩展).这个想法是用户可以回复,用户也可以扩展讨论.请看图片.

我开发了一个控件,只要用户回复或扩展评论,它就会动态添加.
如果用户将对控件进行回复,则将在该消息(注释)下添加新控件,如果用户展开该消息(注释),则将在该消息的右侧添加具有扩展回复(消息)的控件(注释).多个用户可以展开消息,用户也可以回复扩展消息.
我不确定应该添加这些控件的占位符或容器应该是什么.
Table控件TableRows并TableCells
动态创建吗?divs在运行时创建和调整其位置并在每个中添加控件
div吗?其他我不清楚的问题是:
scrollbar在Expansions上显示水平还是有其他解决方案?任何帮助/建议?
谢谢.
我在foreach循环中从ArrayList中删除项目并获得以下异常.
收集被修改; 枚举操作可能无法执行.
如何删除foreach中的项目,
编辑: 可能有一个项目要删除或两个或全部.
以下是我的代码:
/*
* Need to remove all items from 'attachementsFielPath' which does not exist in names array.
*/
try
{
string attachmentFileNames = txtAttachment.Text.Trim(); // Textbox having file names.
string[] names = attachmentFileNames.Split(new char[] { ';' });
int index = 0;
// attachmentsFilePath is ArrayList holding full path of fiels user selected at any time.
foreach (var fullFilePath in attachmentsFilePath)
{
bool isNeedToRemove = true;
// Extract filename from full path.
string fileName = …Run Code Online (Sandbox Code Playgroud) 如果WWHERE子句的条件可能不同,是否有任何替代方法来创建存储过程而不将所有查询放在一个长字符串中.
假设我有Orders表我想在这个表上创建存储过程,并且有三列我可以过滤记录.
1- CustomerId,2- SupplierId,3- ProductId.
如果用户仅在搜索条件中提供CustomerId,则查询应如下所示
SELECT * FROM Orders WHERE Orders.CustomerId = @customerId
Run Code Online (Sandbox Code Playgroud)
如果用户仅在搜索条件中提供ProductId,则查询应如下所示
SELECT * FROM Orders WHERE Orders.ProductId = @productId
Run Code Online (Sandbox Code Playgroud)
如果用户只给出了所有三个CustomerId,ProductId和SupplierId,那么将在WHERE中使用所有三个ID进行过滤.
用户也有可能不希望过滤记录,那么查询应该如下所示
SELCT * FROM Orders
Run Code Online (Sandbox Code Playgroud)
每当我必须创建这种过程时,我将所有这些都放在字符串中并使用IF条件来检查参数(@customeId或@supplierId等)是否具有值.
我使用以下方法来创建过程
DECLARE @query VARCHAR(MAX)
DECLARE @queryWhere VARCHAR(MAX)
SET @query = @query + 'SELECT * FROM Orders '
IF (@originationNumber IS NOT NULL)
BEGIN
BEGIN
SET @queryWhere =@queryWhere + ' Orders.CustomerId = ' + CONVERT(VARCHAR(100),@customerId)
END
END
IF(@queryWhere <> '')
BEGIN
SET @query = @query+' WHERE ' + @queryWhere
END …Run Code Online (Sandbox Code Playgroud) 我有一个表,我想在其中记录应用程序某些部分的活动。当在其他表中插入/更新记录时,将在该表中插入一条记录(将来可能会更新)。
例如
ETC..
我应该在这些表上使用触发器在日志表中添加记录,还是应该在代码中使用通用方法并在发生插入/更新活动时调用该方法?
我必须在应用程序的某些部分执行此活动,因此可能有超过 20 个表,我将在其中添加触发器,或者从几个不同的位置调用方法。
我正在使用 SQL Server 2005 和 C#
触发器和方法哪个更好?