使用OpenPop连接到Gmail时,我只能检索一次电子邮件,即使我不删除它也是如此.使用GetMessageCount()我总是收到0封电子邮件.我怎样才能收到那里的所有电子邮件?
只有在阅读并处理它们之后,我才能下令删除.我使用以下代码来获取电子邮件:
using (var client = new Pop3Client())
{
// Connect to the server
client.Connect(serverData.Hostname, serverData.Port, serverData.UseSsl);
// Authenticate ourselves towards the server
client.Authenticate(serverData.Username, serverData.Password, AuthenticationMethod.UsernameAndPassword);
var emailAmount = client.GetMessageSizes().Count;
// Fetch all the current uids seen
var msgCount = client.GetMessageCount();
.....
}
Run Code Online (Sandbox Code Playgroud) 我有以下代码执行查询并返回结果.但是,我环顾四周并找到一些例子来处理空值,但是我收到一个错误:"当没有数据存在时无效的读取尝试." 我也得到了错误:"从类型'DBNull'转换为'Decimal'类型无效."
有人可以帮我解决这个代码,以防止空值崩溃我的程序?
Private Sub EFFICIENCY_STACKRANK_YTD(ByVal EMPLOYEE As String)
Dim queryString As String = "SELECT " & _
" (SELECT CAST(SUM(TARGET_SECONDS) AS DECIMAL)/ CAST(SUM(ROUTE_SECONDS) AS DECIMAL) FROM dbo.APE_BUSDRIVER_MAIN WITH(NOLOCK) WHERE APE_AREA_OBJID = " & lblAreaOBJID.Text & " AND EMPLOYEE_NAME = '" & EMPLOYEE & "' AND YEAR_TIME = '" & cbYear.Text & "' AND ACTIVE = 1) AS RESULT1" & _
" FROM dbo.APE_BUSDRIVER_MAIN "
Using connection As New SqlConnection(SQLConnectionStr)
Dim command As New SqlCommand(queryString, connection)
connection.Open()
Dim reader As …Run Code Online (Sandbox Code Playgroud) 这是代码:
protected void Button9_Click(object sender, EventArgs e)
{
try
{
// create an instance of TcpClient
TcpClient tcpclient = new TcpClient();
// HOST NAME POP SERVER and gmail uses port number 995 for POP
tcpclient.Connect("pop.gmail.com", 995);
// This is Secure Stream // opened the connection between client and POP Server
System.Net.Security.SslStream sslstream = new SslStream(tcpclient.GetStream());
// authenticate as client
sslstream.AuthenticateAsClient("pop.gmail.com");
//bool flag = sslstream.IsAuthenticated; // check flag
// Asssigned the writer to stream
System.IO.StreamWriter sw = new StreamWriter(sslstream);
// Assigned …Run Code Online (Sandbox Code Playgroud) 这是一个初学者的问题.我想从数据库(MSSQL)动态创建div .例如,我想在条目下面显示评论.该评价表连接项由表的EntryID.我的aspx代码如下:
<div class="commentBody" runat="server">
<asp:Label ID="commentSender" runat="server" Text=""></asp:Label>
<asp:Label ID="commentDate" runat="server" Text=""></asp:Label>
<asp:Label ID="commentText" runat="server" Text=""></asp:Label>
</div>
Run Code Online (Sandbox Code Playgroud)
所有评论都会重复这一点.我正在处理所有代码隐藏(没有逃避).我的c#代码:
protected void YorumlariGetir()
{
string selectComments = "SELECT * FROM Comment WHERE Comment.EntryID = @EntryID";
SqlConnection conn = new SqlConnection(constr);
SqlCommand cmd = new SqlCommand(selectComments, conn);
cmd.Parameters.AddWithValue("@EntryID", Session["EntryID"].ToString());
try
{
conn.Open();
// HERE I WANT TO CALL A LOOP FOR COMMENTS
}
catch (Exception ex)
{
Response.Write("Hata: " + ex.Message);
}
finally
{ …Run Code Online (Sandbox Code Playgroud) 我正在使用Visual Studio 2012 Professional.今天早上我正在编写一个简单的函数,这个例子非常重要:
public DateTime getDeadline()
{
var deadline = DateTime.Now.Date;
if (deadline.DayOfWeek == DayOfWeek.Sunday)
return deadline.AddDays(-2);
if (deadline.DayOfWeek == DayOfWeek.Saturday)
return deadline.AddDays(-1);
return deadline;
}
Run Code Online (Sandbox Code Playgroud)
我想从Microsoft的MSDN页面阅读有关DateTime的"DayOfWeek"属性的更多信息.所以我在Google搜索中输入了"DateTime.DayOfWeek",自然而然后第一个结果就是我想要的.
我的问题很简单...... Visual Studio 2012是否有办法直接从IDE获取类或属性的MSDN页面,因此我不必使用Web搜索?
我尝试实现一个对象继承,其中每个对象共享相同的功能,但包含不同的值/容器.这样做我发现了一种奇怪的行为; 每个单独的对象都像魅力一样,但它们都有相同的选择.请澄清我的意思,我添加了一个示例代码.
我想要做的是从每个元素读取数据值并将其绑定到选项.在某些功能中需要这些才能正常工作!
<div class="first" data-value="first div"></div>
<div class="second" data-value="second div"></div>
<script>
var original = {
options: {
value: null,
factor: 13
},
init: function (container) {
this.options.value = container.getAttribute('data-value');
}
};
var variation = Object.create(original);
variation.options.factor = 37;
var firstDiv = Object.create(variation);
var secondDiv = Object.create(variation);
firstDiv.init(document.getElementsByTagName('div')[0]);
secondDiv.init(document.getElementsByTagName('div')[1]);
alert('firstDiv.options === secondDiv.options: ' + (firstDiv.options === secondDiv.options)); // but should be false!
</script>
Run Code Online (Sandbox Code Playgroud)
请注意,这只是显示实际对象的一小部分.在我看来,所有其他部分都是无关紧要的.
我希望问题很清楚.我也是Object.create()故意使用的.
我使用openpop .net库从邮件服务器检索邮件与POP3.一切正常但我无法检索每个邮件附件的大小.我创建了GetMessageSize(i),但这个大小是所有附件的总和.
那么问题是我如何检索每个附件的大小.
有谁能够帮我?谢谢!
我知道这个问题有各种变化,但找不到能满足我要求的东西.
我继承了一个数据库,并从另一个不再在图片中的程序员那里得到报告.
其中一个查询使用此代码:
Select
b.HospitalMasterID
,b.TxnSite
,b.PatientID
,b.TxnDate as KeptDate
From
Billing as b
Inner Join Patient as p
on b.HospitalMasterID = p.HospitalMasterID
and b.PatientID = p.PatientID
Where
b._IsServOrItem=1
and b.TxnDate >= '20131001'
and (Case
When b.ExtendedAmount > 0 Then 1
When (Not(p.PlanCode is null)) and (b.listAmount >0) then 1
End = 1)
Run Code Online (Sandbox Code Playgroud)
当我运行查询时,我得到了返回的900,000行.如果我删除Case语句,我会返回超过一百万行.
有人可以解释为什么会这样吗?案件陈述到底是做什么的?有没有更好的方法来完成同样的事情.我真的不喜欢这个陈述,因为缺乏结构,整个报表查询很难阅读.
Sql的版本是T-Sql 2012.
谢谢,
我正在使用 Excel VBA、Selenium 和 Chrome。
Threse 是一个下拉框,我正在尝试选择一个选项。html代码是:
<div class="x-form-field-wrap x-form-field-trigger-wrap x-abs-layout-item x-trigger-wrap-focus" id="ext-gen437" style="width: 100px; left: 330px; top: 70px;">
<input maxlength="1" spellcheck="false" id="ext-comp-1233" name="CITTADINANZA" class="x-form-text x-form-field x-field-uppercase x-trigger-noedit x-form-focus" readonly="" style="width: 75px;" />
<img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" alt="" class="x-form-trigger x-form-arrow-trigger" id="ext-gen438" />
</div>
Run Code Online (Sandbox Code Playgroud)
显示的文本选项是“Si”和“No”,但在 Html 代码中没有选项、索引、值...(它只是一个输入元素;img 元素是您必须单击下拉列表的箭头)
我尝试使用以下方式填充输入元素:
driver.FindElementByCss("#ext-comp-1233").AsSelect.SelectByIndex
driver.FindElementByCss("#ext-comp-1233").AsSelect.SelectByValue
driver.FindElementByCss("#ext-comp-1233").AsSelect.SelectByText
driver.FindElementByCss("#ext-comp-1233").Sendkeys
Run Code Online (Sandbox Code Playgroud)
但我收到错误:“意外的 TagName 错误。预期=选择得到=输入”
...而 Sendkeys 不起作用。
你有什么主意吗?
谢谢 :)
我正在使用OpenPop.Net连接到C#应用程序中的GoDaddy托管电子邮件帐户.Authenticate()方法抛出异常,并显示错误消息"用于检索响应的流已关闭".我加倍检查POPServer,POPPort,POPUserName和POPPassword值是否有效使用Outlook 2007.
using (Pop3Client pop3 = new Pop3Client())
{
pop3.Connect(POPServer, POPPort, false);
pop3.Authenticate(POPUserName, POPPassword);
Int32 messageCount = pop3.GetMessageCount();
}
Run Code Online (Sandbox Code Playgroud) 在openpop中我们必须调用disconnect()或dispos()来提交delete命令,如何在调用pop3Client.DeleteMessage()时立即删除消息?