本文整理汇总了C#中DBConnection.executeReturningQuery方法的典型用法代码示例。如果您正苦于以下问题:C# DBConnection.executeReturningQuery方法的具体用法?C# DBConnection.executeReturningQuery怎么用?C# DBConnection.executeReturningQuery使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBConnection
的用法示例。
在下文中一共展示了DBConnection.executeReturningQuery方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: recoverPassword2
public String recoverPassword2(String SendtoAddress)
{
String query = String.Format("SELECT u.u_name, u.passd FROM UserAcc AS u, Candidate AS c WHERE c.email= '{0}' AND u.u_id=c.u_id", SendtoAddress);
DataTable myTable = new DataTable();
DBConnection myConnection = new DBConnection();
myConnection.connect("LILY-PC", "projectdb1", "admin", "123");
myTable = myConnection.executeReturningQuery(query);
DataRow[] rowArray = myTable.AsEnumerable().Take(1).ToArray();
object[] objectArray = rowArray[0].ItemArray;
String[] stringArray = Array.ConvertAll(objectArray, (p => Convert.ToString(p)));
String body = String.Format("Your login credentials for the project by DILIGENTIA are as follows, <br /><br /><b>Username:</b> {0}<br /><b>Password:</b> {1}", stringArray[0], stringArray[1]);
//String body = stringArray[0] + stringArray[1];
MailMessage msg = new MailMessage();
System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient();
try
{
msg.Subject = "Recover Password";
msg.Body = body;
msg.From = new MailAddress("[email protected]");
msg.To.Add(SendtoAddress);
msg.IsBodyHtml = true;
client.Host = "smtp.gmail.com";
System.Net.NetworkCredential basicauthenticationinfo = new System.Net.NetworkCredential("[email protected]", "diligentia");
client.Port = int.Parse("587");
client.EnableSsl = true;
client.UseDefaultCredentials = false;
client.Credentials = basicauthenticationinfo;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Send(msg);
return "Sucessful Completion";
}
catch (Exception ex)
{
return (ex.Message);
}
}
示例2: recoverPassword
public String recoverPassword(String SendtoAddress)
{
String fromAddress = "[email protected]";
String toAddress = SendtoAddress;
const String password = "diligentia";
const String subject = "Retrieving Password";
String query = String.Format("SELECT u.u_name, u.passd FROM UserAcc AS u, Candidate AS c WHERE c.email= '{0}' AND u.u_id=c.u_id", SendtoAddress);
DataTable myTable = new DataTable();
DBConnection myConnection = new DBConnection();
myConnection.connect("LILY-PC", "projectdb1", "admin", "123");
myTable = myConnection.executeReturningQuery(query);
DataRow[] rowArray = myTable.AsEnumerable().Take(1).ToArray();
object[] objectArray = rowArray[0].ItemArray;
String[] stringArray = Array.ConvertAll(objectArray, (p => Convert.ToString(p)));
String body = stringArray[0] + stringArray[1];
try
{
SmtpClient smtp = new SmtpClient
{
Host = "smtp.gmail.com",
Port = 587,
EnableSsl = true,
DeliveryMethod = SmtpDeliveryMethod.Network,
Credentials = new NetworkCredential(fromAddress, password),
Timeout = 3000
};
MailMessage message = new MailMessage(fromAddress, toAddress, subject, body);
smtp.Send(message);
}
catch (Exception ex)
{
}
return stringArray[0];
}
示例3: getCV
public DataTable getCV(String id)
{
DataTable myTable = new DataTable();
DBConnection myConnection = new DBConnection();
myConnection.connect("LILY-PC", "projectdb1", "admin", "123");
String query = String.Format("SELECT c.f_name AS 'First Name' ,c.m_name AS 'Middle Name', c.l_name AS 'Last Name', c.dob AS 'Date of Birth', c.age AS 'Age', c.gender AS 'Gender', c.maritual_status AS 'Marital Status', c.add_no AS 'Number',c.add_street AS 'Street', c.add_town AS 'Town',c.email AS 'Email', p.phone AS 'Phone', s.school AS 'School' FROM [Candidate] AS c, PrsPhone AS p, CanSchool AS s WHERE c.u_id=p.u_id AND c.u_id=s.u_id AND c.u_id={0}", id);
myTable = myConnection.executeReturningQuery(query);
return myTable;
}
示例4: getInfo
public DataTable getInfo(String id)
{
DataTable myTable = new DataTable();
DBConnection myConnection = new DBConnection();
myConnection.connect("LILY-PC", "projectdb1", "admin", "123");
String query = String.Format("SELECT c.f_name AS 'First Name' ,c.m_name AS 'Middle Name', c.l_name AS 'Last Name', c.prs_email AS 'Personal Email', c.company AS 'Company',c.cmp_add_no AS 'C.A.No',c.cmp_add_street AS 'C.A.St',c.cmp_add_town AS 'C.A.tw',c.cmp_email AS 'Cm.Email',p.phone AS 'Pers Phone',b.phone AS 'Bus Phone' FROM Manager AS c, PrsPhone AS p, BusPhone AS b WHERE c.u_id=p.u_id AND c.u_id=b.u_id AND c.u_id={0}", id);
myTable = myConnection.executeReturningQuery(query);
return myTable;
}
示例5: getPostsOFForum
public DataTable getPostsOFForum(String forumID)
{
DataTable myTable = new DataTable(); ;
DBConnection myConnection = new DBConnection();
myConnection.connect("LILY-PC", "projectdb1", "admin", "123");
String query = String.Format("SELECT p.post FROM Post AS p, Forum AS f WHERE f.f_id = {0} AND f.f_id = p.f_id ORDER BY p.p_time", forumID);
myTable = myConnection.executeReturningQuery(query);
return myTable;
}