Thursday, 19 January 2012

Restore Database SQL Service Using Command


1. Command to Restore Database form Bak File.

RESTORE DATABASE [MyDB] FROM  DISK = N'D:\Backup\DBBackup\ MyDB .bak' WITH  FILE = 1,  NOUNLOAD,  REPLACE,  STATS = 10
GO

2. Thank for Reading this Blog.

our new blog site : http://blog.hintechnology.com

Calling Web Service Using Jquery Ajax



1. Create the Web Service To Send Email and Call that Web Service Using JQuery.

i. Create a form 















2. On the SubMit Button Write the Following Code on its OnClientClick="retun CallServiceMail()".

<script type="text/javascript">
        function CallServiceMail() {
            var name = $('#nameMsg').val();
            var email = $('#emailMsg').val();
            var phone = $('#phoneMsg').val();
            var messageemail = $('#messageMsg').val();
            var messageto = "info@abakinfotech.com";
            var subjectemail = "Enquiry from web site contact form";
            $.ajax({
                type: "POST",
                url: "SendEmail.asmx/SendMail",
                data: "{'nameemail': '" + name + "', 'emailid': '" + email + "', 'phone': '" + phone + "', 'message': '" + messageemail + "', 'emailTo': ' " + messageto + "', 'subjectemail': ' " + subjectemail + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: OnSuccess,
                error: OnError
            });
            function OnSuccess(data, status) {
                if (data.d == "1") {
                    $('#nameMsg').attr("value", "");
                    $('#emailMsg').attr("value", "");
                    $('#phoneMsg').attr("value", "");
                    $('#messageMsg').attr("value", "");
                    $("#contactsubmit").show();
                    window.location = "thankyou.html#successMsg"
                }
            }
            function OnError(request, status, error) {
                if (request.statusText == 0) {
                    $("#contactsubmit").show();
                    alert("There is some error in sending mail, sorry for incovinience");
                }
            }
        }
    
</script>
</div>

our new blog site : http://blog.hintechnology.com

Send Email Using Gmail in Asp.net




1. Add the following text in the Web.config file for the your application.

<system.net>
  <mailSettings>
<smtp deliveryMethod="Network" from="sendmail@gmail.com">
<network host="smtp.gmail.com" password="password12
                                  userName="sendmail" defaultCredentials="false" port="587" />
</smtp>
  </mailSettings>
</system.net>

  i  . sendmail@gmail.com In this place enter your gmailid
  ii . sendmail In this place enter your gmailid
  iii. password12 In this place enter your gmailpassword

2. Create this form.























2. Add this method to send your mail & call where ever its required.

    public void SendMail(string FromEmail, string ToEmail, string CC, string subject, string body)
    {
        System.Web.Mail.MailMessage Message = new System.Web.Mail.MailMessage();
        Message.From = FromEmail;
        Message.To = ToEmail;
        Message.Cc = CC;
        Message.Subject = subject;
        Message.Body = body;
        Message.BodyFormat = MailFormat.Html;
        SmtpMail client = new SmtpMail ();
        client.Send (Message);
    }



3. On Send Button Event Write this Code
    
        protected void btnSendEmail_Click(object sender, EventArgs e)
        {
            try
            {
                SendMail(txtFromID.Text.Trim(), txtToEmailID.Text.Trim(), txtCcEmailID.Text.Trim(), 
                                txtSubject.Text.Trim(), txtBody.Text.Trim());
        
            }
            catch (Exception)
            {
            }
       }


4. If you have any other Other Solution please send me. 
5. If any issue please comment.
6. Thanks for Reading this Blog.

our new blog site : http://blog.hintechnology.com

Wednesday, 18 January 2012

SQL Server Reporting Configuration and Report File Upload

our new blog site : http://blog.hintechnology.com

       1)      Start à Microsoft SQL Server 2008 R2 à Configuration Tool àReporting Services Configuration      Manager àClick

       2)      It will display following window à Click Connect













3)  Now Click on IE à Type http://<SiteName>//Reports (It will displaying blank windo







Monday, 16 January 2012

Set Value in People Picker Control In SharePoint

our new blog site : http://blog.hintechnology.com

Set the Value of People Picker Control in SharePoint

Dynamically

peoplepicInitiatedBy.CommaSeparatedAccounts = Context.User.Identity.Name;

Static

peoplepicInitiatedBy.CommaSeparatedAccounts = "domain\Username";




Sunday, 15 January 2012

Split Example in C#

our new blog site : http://blog.hintechnology.com

Split Example in C# 
using System;

public class SplitExample {
    public void SplitExample() {

        string words = "This is split example. Testing User in SharePoint 2010 "+                                 "user with Domain\\username ";

        string [] split = words.Split(new Char [] {' ', ',', '.', ':', '\t' });

        foreach (string s in split) {

            if (s.Trim() != "")
                Response.Write(s);
        }
    }
}
// This will display following output://       This//       is//       split //       example//       Testing//       User//       in//       SharePoint//       2010//       user//       with//       Domain//       username
Thank you for Reading This Posts.