我有一个关于使用SQL Server 2008 R2的问题.
我最近遇到了计算机问题,因此我不得不重新启动Windows,并且必须将一个用户的权限授予另一个用户(使用属性中的安全功能).最初提供权限时,通过"拒绝访问"消息.
经过大量研究后,它停止产生此错误(我需要授予权限的用户也无法使用),这会导致另一个问题发生,但这次是在SQL Server中.它产生这个信息;
无法访问数据库[dbName].(ObjectExplorer)
当我尝试选择下拉选项以查看SQL Server中的数据库的表和存储过程列表时,会发生此错误.我在以下链接中找到了解释;
然后我尝试这样实施;
USE msdb;
GO
GRANT CONNECT TO [DBName\MyName] ;
CREATE DATABASE [DBNAME] ON PRIMARY
Run Code Online (Sandbox Code Playgroud)
使用我创建的脚本(幸运的是在此问题发生之前)它通过大量的消息;
消息15151,级别16,状态1,行1
找不到用户'DBName\MyName',因为它不存在或您没有权限.
Msg 262,Level 14,State 1,Line 2
CREATE DATABASE权限在数据库'master'中被拒绝.
消息5011,级别14,状态9,行1
用户无权更改数据库'DBName',数据库不存在,或者数据库未处于允许访问检查的状态.
Msg 5069,Level 16,State 1,Line 1 ......
在这一系列错误之后,我已经变得不稳定,因此如果有人能就我能解决这个问题的方法给我一些反馈,我将不胜感激.干杯.
我正在创建一个应用程序,使用户能够插入,更新和删除已输入的数据,然后在数据网格中显示(CRUD操作).
在我的视图模型中,它包含绑定到xaml的属性(Firstname例如).它还包含导航属性以及验证属性.
[Required(ErrorMessage = "First Name is a required field")]
[RegularExpression(@"^[a-zA-Z''-'\s]{1,20}$", ErrorMessage = "First Name must contain no more then 20 characters and contain no digits.")]
public string FirstName
{
get { return _FirstName; }
set
{
if (_FirstName == value)
return;
_FirstName = value;
OnPropertyChanged("FirstName");
}
}
Run Code Online (Sandbox Code Playgroud)
此外,它包含xaml要执行的命令,它创建CRUD操作的实例;
private void UpdateFormExecute()
{
var org = new OrganisationTypeDetail();
UpdateOrganisationTypeDetail(org);
}
Run Code Online (Sandbox Code Playgroud)
最后,它还包含CRUD操作.例如Insert,Update和Delete.
这引出了我的问题.如果我想实现正确的MVVM方式,那么所有这些代码对于包含的视图模型来说太多了吗?
我是否应该使用该模型并在我的View模型中创建一个集合并将其绑定到我的xaml?这是正确的做法吗?
我应该使用存储库系统进行CRUD操作吗?如果是这样,我如何将数据从文本字段传递到模型以进行更新?
我是WPF,MVVM的新手,如果没有适当的指导,很难适应.
我在WPFappcation中使用DataBinding了一个comboBox.projectList中的ProjectName应该在我的内部添加comboBox,但是当我运行应用程序时,每次我都会收到这些错误;
System.Windows.Data错误:40:BindingExpression路径错误:'object'''DayView'(Name ='MainWin')'上找不到'projectList'属性.BindingExpression:路径= projectList; DataItem ='DayView'(Name ='MainWin'); target元素是'ComboBox'(Name =''); 目标属性是'ItemsSource'(类型'IEnumerable')System.Windows.Data错误:40:BindingExpression路径错误:'object'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' BindingExpression:路径= selectedProjectid; DataItem ='ComboBox'(Name =''); target元素是'ComboBox'(Name =''); target属性是'SelectedValue'(类型'Object')
我使用数据绑定的xaml代码是:
<DataTemplate x:Key="EditableDataTemplate">
<StackPanel Orientation="Horizontal" Width="596">
<TextBox Text="{Binding ClientNameBinding}" Background="Yellow" Padding="0" Margin="0" BorderThickness="0" TextWrapping="Wrap" Width="145"/>
<TextBox Text="{Binding ApplicationNameBinding}" Background="Yellow" Padding="0" Margin="0" BorderThickness="0" TextWrapping="Wrap" Width="90"/>
<TextBox Text="{Binding StartTimeBinding}" Background="Yellow" Padding="0" Margin="0" BorderThickness="0" TextWrapping="Wrap" Width="100"/>
<TextBox Text="{Binding StopTimeBinding}" Background="Yellow" Padding="0" Margin="0" BorderThickness="0" TextWrapping="Wrap" Width="60"/>
<TextBox Text="{Binding TaskNameBinding}" Background="Yellow" Padding="0" Margin="0" BorderThickness="0" TextWrapping="Wrap" Width="130"/>
<ComboBox x:Name="ComboBox2" ItemsSource="{Binding …Run Code Online (Sandbox Code Playgroud) 我正在创建一个应用程序,允许用户EntityFramework使用WPF 将一些Employee详细信息添加到模型中.
到目前为止,我有一个ListView代表员工姓名列表,当您选择员工的名称时,它会选择另一个员工的特定数据ListView.我用a Predicate和a 完成了这个ICollectionSource.
但我现在想要实现的是拥有一个所谓的搜索引擎.因此,当用户在其中键入员工姓名时,TextBox它会过滤员工姓名的名称,具体取决于在搜索框中键入的内容.
我使用This Link作为指南,但我不太确定如何在我自己的设计中实现它; 在示例中,他们使用了a Resource并使用过Array.
这是我尝试过的,使用Predicate;
private EmployeeListViewModel()
: base("")
{
EmployeeList = new ObservableCollection<EmployeeViewModel>(GetEmployees());
this._view = new ListCollectionView(this.employeeList);
}
private ListCollectionView _view;
public ICollectionView View
{
get { return this._view; }
}
private string _TextSearch;
public string TextSearch
{
get { return _TextSearch; }
set
{
_TextSearch = value;
OnPropertyChanged("TextSearch");
if (String.IsNullOrEmpty(value))
View.Filter = null;
else …Run Code Online (Sandbox Code Playgroud) 我正在尝试获取子对话框窗口的句柄。我试过使用FindWindowEx,但没有用。相反,FindWindow确实起作用。
我使用以下代码对Visual Studio的“选项”窗口进行了实验:
IntPtr vsHandle = Process.GetProcessById(vsProcessId).MainWindowHandle; // consistent with spy++'s parent handle of options window
IntPtr optionsHandle = FindWindowEx(vsHandle, IntPtr.Zero, "#32770", "Options"); // returns 0
IntPtr optionsHandle2 = FindWindow("#32770", "Options"); // returns correct handle
Run Code Online (Sandbox Code Playgroud)
据我了解,FindWindowEx应该已经工作了,它是一个子窗口。
我正在运行Windows XP,并且还尝试使用FindWindowEx(vsHandle,IntPtr.Zero,“#32770”,null)。没用 似乎唯一的获得方法是使用FindWindow,因为打开具有相同对话框的两个父实例并不足够。
这是声明:
[DllImport("user32.dll")]
Private static extern IntPtr FindWindow(string className, string windowTitle);
[DllImport("user32.dll")]
Private static extern IntPtr FindWindowEx(IntPtr parentHWnd, IntPtr childAfterHWnd, string className, string windowTitle);
Run Code Online (Sandbox Code Playgroud)
提前致谢。
我有一个home.aspx页面,我有两个面板.在第一个面板中,我动态绑定了一个用户控件(用于在左侧显示meiny),在第二个面板中我显示了页面.我在页面加载时动态绑定用户控件.
if (!IsPostBack)
{
UserControl uc = (UserControl)Page.LoadControl("~/settings/Links/Navigation.ascx");
Accordion1.Controls.Add(uc);
}
Run Code Online (Sandbox Code Playgroud)
当第一次加载页面时我的usercontrol是绑定并显示我的菜单,但是当我点击它隐藏的任何菜单项时(用户控件),
请帮帮我,提前谢谢!
我json喜欢这个(删除它的一部分因为它不是问题)
{
"obj" : {
"id" : "a18",
"param" : {
"system" : 0,
"member_fill" : "0",
"name" : "MainAnketa",
"multi" : 0
}
}
}
Run Code Online (Sandbox Code Playgroud)
我尝试在Newton.Json的帮助下将其反序列化为以下对象:
public class GetMainAnketaResponse
{
[JsonProperty(PropertyName = "obj")] public Anketa AnketaData;
public class Anketa
{
[JsonProperty(PropertyName = "order")]
public List<string> FieldsOrder;
[JsonProperty(PropertyName = "id")]
public string Id;
[JsonProperty(PropertyName = "param")]
public List<Parameter> Parameters;
public class Parameter
{
[JsonProperty(PropertyName = "system")]
public int System;
[JsonProperty(PropertyName = "member_fill")]
public string MemberFill;
[JsonProperty(PropertyName = "name")] …Run Code Online (Sandbox Code Playgroud) 我想javascript从后面的代码中确认popup返回值.这里当用户选择ok按钮确认弹出时,一些代码进入这里,或者用户选择取消按钮弹出一些代码就在这里.
如何从代码中获取所选值?
我的代码是;
if (ClientScript.RegisterStartupScript(typeof(Page), "Confirm", "<script type='text/javascript'>return Confirm('Do you Want to Delete');</script>"))
{
db.Deletedevicedate();
clear();
}
else
{
clear();
}
Run Code Online (Sandbox Code Playgroud) c# ×7
wpf ×3
asp.net ×2
mvvm ×2
datagrid ×1
findwindowex ×1
javascript ×1
json.net ×1
listview ×1
sql ×1
sql-server ×1
winapi ×1
xaml ×1