大家好我所有的日期为22.08.2010 in到一个字符串我怎么能把它转换为22/08/2010
我将使用我的计算机读取文件
StreamReader sr = new StreamReader(FileName);
string str = sr.ReadToEnd();
Run Code Online (Sandbox Code Playgroud)
在这里我得到一些非法字符,如/ n,/ r和其他一些.
我想用空字符替换非法字符.我尝试制作一个角色阵列,但我无法删除那些,所以任何人都可以帮助我
我想找到datagridview的最后一行,我想将特定的行数据写入文本文件,任何人都可以帮助我
如果用户输入大于零的值,我编写了一个代码来打开表单,如下所示
private void txtNoOfAddenda_Leave(object sender, EventArgs e)
{
string traceNo = string.Empty;
int i = 0;
if (!int.TryParse(txtNoOfAddenda.Text, out i))
{
MessageBox.Show("Enter numeric value betewwn(0-9999)");
txtNoOfAddenda.Focus();
}
else
{
if (i > 0)
{
traceNo = txtTraceNo.Text.Substring(8, 7);
frmAddenda frmAddenda = new frmAddenda(i, traceNo);
frmAddenda.ShowDialog();
}
}
}
Run Code Online (Sandbox Code Playgroud)
这工作正常,但如果我移回我的选项卡,如果再次文本框离开相同的代码执行我只需要这一次被解雇一次可以任何人给我一个想法..
需要正则表达式来替换以下序列
Before : abbbccdd After : abcd
Run Code Online (Sandbox Code Playgroud)
而且,如果存在数字数据而不是字母,我想删除重复和显示
到目前为止,我们已经完成了一个项目,但是从昨天起我们遇到了一个奇怪的问题,即sessions自动结束,甚至authentication在配置的时间之前有一段时间失败.执行某些操作后的某个时间button_click或dropdown_selectedIndex会话自动结束.我们还没有在这些事件中写任何代码来杀死session为什么会发生这种情况可以任何人告诉我
我的样本 web.config
<authentication mode="Forms">
<forms loginUrl="Default.aspx" defaultUrl="cliMainPage.aspx"
timeout="10" />
<caching>
<outputCacheSettings>
<outputCacheProfiles>
<add name="profile" duration="30" enabled="true" varyByParam="pageNumber"/>
</outputCacheProfiles>
</outputCacheSettings>
</caching>
Run Code Online (Sandbox Code Playgroud) 大家好,是否可以在不使用的情况下加载 excel 数据OLEDB,我已经使用连接字符串编写了如下代码.xls and .xlsx
ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + pFilePath + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=2\"";
ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + pFilePath + ";Extended Properties=\"Excel 12.0;HDR=Yes;IMEX=2\"";
在我的系统中不存在12.0相关的dll我收到错误。所以我想知道是否有任何方法可以实现我的要求而不是一般方法
编写的示例代码
public void Method(string pFilePath)
{
DataTable dt = new DataTable();
using (SpreadsheetDocument spreadSheetDocument = SpreadsheetDocument.Open(pFilePath, false))
{
WorkbookPart workbookPart = spreadSheetDocument.WorkbookPart;
IEnumerable<Sheet> sheets = spreadSheetDocument.WorkbookPart.Workbook.GetFirstChild<Sheets>().Elements<Sheet>();
string relationshipId = sheets.First().Id.Value;
WorksheetPart worksheetPart = (WorksheetPart)spreadSheetDocument.WorkbookPart.GetPartById(relationshipId);
Worksheet workSheet = worksheetPart.Worksheet;
SheetData sheetData = workSheet.GetFirstChild<SheetData>();
IEnumerable<Row> rows = sheetData.Descendants<Row>();
foreach …Run Code Online (Sandbox Code Playgroud) 大家好我已经编写了代码来下载文件作为zip和保存,但我得到一个例外Could not find file 'C:\Program Files (x86)\IIS Express\fileName.txt'..这是我的代码可以帮助我一些人
protected void btnDownload_Click(object sender, EventArgs e)
{
ZipFile zip = new ZipFile();
zip.AddFile("fileName.txt");
string pathString = System.IO.Path.Combine(Path.GetTempPath(), "Attachments_" + DateTime.Now.ToString("yyyyMMddHHmmss"));
System.IO.Directory.CreateDirectory(pathString);
string sFilePath = System.IO.Path.Combine(pathString, "attachment.zip");
File.Create(sFilePath);
Response.BufferOutput = false; // for large files
Response.ContentType = "application/zip";
Response.AddHeader("content-disposition", "filename=" + sFilePath);
zip.CompressionLevel = Ionic.Zlib.CompressionLevel.BestCompression;
zip.AddDirectory(pathString);
zip.Save(Response.OutputStream);
zip.Dispose();
}
Run Code Online (Sandbox Code Playgroud) 大家好我的文件夹结构如下
D:\Exclude
Include
Include1
Exclude
Include
Run Code Online (Sandbox Code Playgroud)
我需要的是我想过滤目录Include1\Exclude这是我尝试过的无法正常工作的目录
$Path ="D:\Exclude"
$DirList = Get-ChildItem -Path "$Path" -Recurse | where {$_.DirectoryName -ne "D:\Exclude\Include1\Exclude"}
$DirList
Run Code Online (Sandbox Code Playgroud) 当我点击显示的消息框时,我想提示用户输入保存文件对话框.我怎样才能做到这一点...
c# ×8
asp.net ×5
winforms ×2
datagridview ×1
oledb ×1
powershell ×1
regex ×1
session ×1
zipfile ×1