使用Delphi 2010
SQLQuery1.First; // move to the first record
while(not SQLQuery1.EOF)do begin
// do something with the current record
// What's the code should i write in this part in order to create a TEdit
// containing the user fullname the current item.
ShowMessage(SQLQuery1['whom']);
SQLQuery1.Next; // move to the next record
end;
Run Code Online (Sandbox Code Playgroud) 我想创建一个警告对话框,询问用户注册期间输入的信息是否正确,并询问他是否要继续或关闭该对话框并更正其信息.
使用Delphi 2010,我使用TSQLQuery和TSQLConnection连接到远程MySQL服务器.我使用了如下SQL查询:
SQLQuery1.SQL.Text := 'SELECT * FROM registered WHERE email="'+email+'" and login_pass="'+password+'"';
SQLQuery1.Open; // Open sql connection
Run Code Online (Sandbox Code Playgroud)
如何列出或显示此查询选择的数据?
当我输入
SQLQuery1['who']; // The resault is : James Kan
Run Code Online (Sandbox Code Playgroud)
我认为它显示了列表中的最后一项.但我希望显示每个项目,就像我在PHP中使用foreach循环一样.我怎样才能为每个项目创建一个TLabel?
如何使用delphi 2010发送电子邮件地址,例如(verefication email,密码丢失或任何html /纯文本电子邮件.
我尝试使用以下代码,但我EIdSocket Eroor with message 'Socket Error #10060 Connection Timed Out'在尝试发送邮件时得到.
procedure TForm5.btnSendMailClick(Sender: TObject);
begin
//setup SMTP
smtppass := ed_IdVerification.Text;
SMTP.Host := 'smtp.google.com'; // Controle a distance
SMTP.Port := 465;
smtp.Username := 'hetallica69@gmail.com';
smtp.Password := QuotedStr(smtppass);
//setup mail message
MailMessage.From.Address := 'hetallica69@gmail.com';
MailMessage.Recipients.EMailAddresses := '_rafik@live.fr';
MailMessage.Subject := 'Confirm your account';
MailMessage.Body.Text := 'Text goes here';
//send mail
try
try
if not smtp.Connected then SMTP.Connect() ;
SMTP.Send(MailMessage) ;
except on E:Exception do
ShowMessage(E.Message);
end;
finally
if …Run Code Online (Sandbox Code Playgroud) 我有一个程序,用于创建其他程序并从*.cs源文件编译它
using System.CodeDom.Compiler;
我想为编译的程序创建一个安装程序,但我想知道我是否可以以编程方式执行此操作,因此当我单击主应用程序中的"立即构建"按钮时,将在所选目标上显示新的安装程序.
有没有办法通过点击按钮为已编译的程序(我构建的程序)创建一个msi安装程序.
每次我想为编译的程序创建安装程序时,我都不想使用InstallShield.
任何帮助将受到高度赞赏
我发现这篇文章如何申请一个C#应用程序.
是否可以按照上述文章中的说明自由签署我自己的申请?
我想在导航到网站后点击链接
webKitBrowser1.Navigate("http://www.somesite.com");
Run Code Online (Sandbox Code Playgroud)
假设链接的ID是lnkId ?如何点击本网站上的链接?
<a href="http://www.google.com" id="lnkId"> Go to Google </a>
Run Code Online (Sandbox Code Playgroud)
在Visual Studio附带的默认浏览器控件中,我可以使用以下代码执行此操作:
foreach (HtmlElement el in webBrowser1.Document.GetElementTagName("a")) {
if (el.GetAttribute("id") == "lnkId") {
el.InvokeMember("click");
}
}
Run Code Online (Sandbox Code Playgroud)
当我使用WebkitDotNet控件时,上面代码的等价物是什么?
我有一个应用程序,在执行时它将two folders with subfolders位于同一位置的副本复制到另一个窗口位置%AppData%
现在我有以下文件:MyApp.exe,Folder1,Folder2
在每个文件夹中都有子文件夹.如何将这两个文件夹作为资源嵌入到应用程序中,因此在编译程序后,我只得到一个可执行文件.当我点击它时,它会将两个文件夹提取到同一个位置,然后完成其余的工作.
我知道如何将文件添加为嵌入式资源,然后使用反射检索它,
但是文件夹怎么样甚至可能?
根据MSDN,如果没有特定类型并使用例如,捕获异常是一种不好的做法System.Net.Exception
每次我要捕获错误时,是否必须深入查看msdn手册以查看可能的异常类型.或者IDE中有什么方法让我快速看到这个.
目前我正在使用Visual Studio 2013 Express Edition
try
{
using (WebClient goog = new WebClient())
{
goog.DownloadString("http://google.com");
}
}
catch(Exception E)
{
saveLog("methodname", E.Message);
}
Run Code Online (Sandbox Code Playgroud)
编辑: 在这个链接中,看起来VS已经有一个显示exeptions的选项,但是,当我选择一个方法时,它只显示方法的类型和参数.但它没有显示例外情况
我正在编写一个小应用程序,它使用函数从源(.cs)代码文件编译文件:
public static bool CompileExecutable(String sourceName)
{
//Source file that you are compliling
FileInfo sourceFile = new FileInfo(sourceName);
//Create a C# code provider
CodeDomProvider provider = CodeDomProvider.CreateProvider("CSharp");
//Create a bool variable for to to use after the complie proccess to see if there are any erros
bool compileOk = false;
//Make a name for the exe
String exeName = String.Format(@"{0}\{1}.exe",
System.Environment.CurrentDirectory, sourceFile.Name.Replace(".", "_"));
//Creates a variable, cp, to set the complier parameters
CompilerParameters cp = new CompilerParameters();
//You can generate …Run Code Online (Sandbox Code Playgroud)