我正在使用sqlite数据库的Windows应用程序.net 2.0,我的连接字符串保持在app.config之类
<connectionStrings>
<add name="SQLiteDB"
connectionString="Data Source=|DataDirectory|database.s3db;version=3;password=mypassword;"
providerName="System.Data.Sqlite"/>
</connectionStrings>
Run Code Online (Sandbox Code Playgroud)
在连接字符串中,我已将密码定义为"mypassword",如果我删除此密码一切正常,但是当我使用密码子句时,它给出了connection.open()语法错误
File opened that is not a database file
file is encrypted or is not a database
Run Code Online (Sandbox Code Playgroud)
我在网上搜索并发现了一些版本问题,但我只使用版本3,因为我在连接字符串中说明我也尝试删除"版本= 3"但问题仍然是相同的.
我是第一次这样做,它的解决方案是什么?
我在表单上有一个gridview并有一些模板字段,其中一个是:
<asp:TemplateField HeaderText="Country" HeaderStyle-HorizontalAlign="Left">
<EditItemTemplate>
<asp:DropDownList ID="DdlCountry" runat="server" DataTextField="Country" DataValueField="Sno">
</asp:DropDownList>
</EditItemTemplate>
</asp:TemplateField>
Run Code Online (Sandbox Code Playgroud)
现在在RowEditing事件上我需要获取国家下拉列表的选定值,然后我将该值设置为Ddlcountry.selectedvalue = value; 这样当编辑项目模板的下拉列表出现时,它将显示所选值而不是下拉列表的0索引.但我无法获得下拉列表的价值.我已经尝试过了:
int index = e.NewEditIndex;
DropDownList DdlCountry = GridView1.Rows[index].FindControl("DdlCountry") as DropDownList;
Run Code Online (Sandbox Code Playgroud)
需要帮助.感谢名单.
在我的Windows应用程序中,我正在尝试加密app.config文件的连接字符串部分,我的app.config文件的连接字符串部分是
<connectionStrings>
<add name="SQLiteDB" connectionString="Data Source=|DataDirectory|database.s3db;
Version=3;password=mypassword;" providerName="System.Data.Sqlite"/>
</connectionStrings>
Run Code Online (Sandbox Code Playgroud)
在.cs文件中,我正在加密它
Configuration config = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath);
ConfigurationSection section = config.GetSection("connectionStrings") as ConnectionStringsSection; // could be any section
if (!section.IsReadOnly())
{
section.SectionInformation.ProtectSection("RsaProtectedConfigurationProvider");
section.SectionInformation.ForceSave = true;
config.Save(ConfigurationSaveMode.Full);
}
Run Code Online (Sandbox Code Playgroud)
运行此代码后,我在另一个app.config中获得加密连接字符串,此app.config位于bin\debug文件夹中,此.config文件的名称为nameofapplication.exe.config.
问题是当我设置此应用程序并在其他计算机上运行时,如果出现以下错误:
System.Configuration.ConfigurationErrorsException: Failed to decrypt using provider 'RsaProtectedConfigurationProvider'. Error message from the provider: The RSA key container could not be opened.
Run Code Online (Sandbox Code Playgroud)
我是第一次这样做,所以不知道如何解决这个问题,严重困扰它.
我将数据从Windows窗体发送到Web服务的形式ArrayList.在Web服务声明我的方法是这样的:
[WebMethod]
public int SaveSelectedOffers(ArrayList offers, int selectedRows)
{
}
Run Code Online (Sandbox Code Playgroud)
在Windows窗体中,点击按钮,我的代码是:
private void offersAvailableSubmit_Click(object sender, EventArgs e)
{
ArrayList options;
options.Add("item 1");
options.Add("item 2");
options.Add("item 2");
//In this line of code it is showing error that Argument 1: cannot convert from 'System.Collections.ArrayList' to 'object[]'
int rowsAffected = serviceCaller.SaveSelectedOffers(options, rowCount);
}
Run Code Online (Sandbox Code Playgroud)
选项的数据类型是ArrayList在Web服务中我也使用ArrayList变量类型来保存此值,那么为什么会出现此错误?
将参数发送到Web服务是否正确?或者还有其他方法吗?
我有一个数据表,我想使用Entity Framework将数据插入数据库(SSMS).什么是可行的解决方案?
我有一个只包含文本框的用户控件,而在另一个表单上我动态添加了这个用户控件,用户可以多次添加用户控件.我使用会话变量来重新创建用户控件(也许这种方法听起来不太酷).重新创建控件后,文本框的值显然会消失.是否有任何解决方案来维护用户控件的回发状态?
我正在使用dataview并使用它的skip and take方法,它将占用5行,并根据页码和页面大小跳过一些行。
//creating a dataview object and assigning table[0]
dv = new DataView(ds.Tables[0]);
Run Code Online (Sandbox Code Playgroud)
而我所面临的错误的下一行是:
dv=(DataView)dv.Cast<System.Data.DataView>().Skip((pageNum-1)*pageSize).Take(5);
Run Code Online (Sandbox Code Playgroud)
在上面的行中发生的错误是:
Unable to cast object of type '<TakeIterator>d__3a`1[System.Data.DataView]' to type 'System.Data.DataView'.
Run Code Online (Sandbox Code Playgroud)
需要帮助。谢谢。
在 Qlikview 中,我们有清除所有选项来清除所有选择,PowerBI 中的类似选项是什么?
即使刷新报告(使用主页中的刷新按钮)也不起作用。
我在某处读到刷新浏览器(如果是网络)可以清除所有选择并恢复前一阶段,但这不是一个可行的解决方案。有没有替代方案?
如何在 PowerBI 中编写此表达式
select distinct([date]),Temperature from Device47A8F where Temperature>25
Run Code Online (Sandbox Code Playgroud)
全新的 PowerBI。是否有任何工具可以将查询从 sql 更改为 PowerBI 表达式?
我尝试了很多类型的不同类型的表达式,但出现错误,大部分时间我都得到这个:
The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.
Run Code Online (Sandbox Code Playgroud)
需要帮助,谢谢。
我的情况是,如果
47/15= 3.13333
Run Code Online (Sandbox Code Playgroud)
我想将它转换为4,如果结果有十进制我想将结果增加1,现在我正在这样做
float res = ((float)(62-15) / 15);
if (res.ToString().Contains("."))
{
string digit=res.ToString().Substring(0, res.ToString().IndexOf('.'));
int incrementDigit=Convert.ToInt16(k) + 1;
}
Run Code Online (Sandbox Code Playgroud)
我想知道c#中是否有任何快捷方式或内置函数,以便我可以快速完成此操作而无需实现字符串函数.
非常感谢.