Tuesday, May 28, 2019

Read More »

date

In this article we will  learn about date and time functions in SQL Server.These functions are working on a given date and time.These functions are SQL pre-defined functions.
Types of Datetime Functions
  1. Getdate
  2. Day
  3. Month
  4. Year
  5. Datename
  6. Dateadd
  7. Datediff
  8. Datepart
Getdate()
Getdate function returns current time and date .
Syntax
  1. select Getdate();  
Day()
This function returns a day value from the given date
Syntax
  1. select DAY('2018/10/31')  
Month
This function returns a month value from the given date
 
Syntax
  1. select Month('2018/10/31')  
Year()
This function returns a year value from the given date
 
Syntax
  1. select year('2018/10/31')  
Datename()
It returns the name of the day and month of a given date expression.
 
Example 
  1. select DATENAME(DW,'2018/10/31')  
  2. select DATENAME(MM,'2018/10/31')  
Result
 
Date And Time Functions In SQL Server 
 
Dateadd()
 
This function is used to add a number  of days, months, years to the given date expression.
 
syntax 
  1. select DATEADD('Day/month/year','No. of number want to add','Date')   
Example
  1. select DATEADD(dd,5,getdate())  
  2. select DATEADD(MM,1,getdate())  
  3. select DATEADD(YYYY,1,getdate())   
Result
 
Date And Time Functions In SQL Server 
Datediff() 
Datediff is use to find the difference between dates. It will return the differences between the starting and ending date expressions.
 
Syntax
  1. select datediff('Day/month/year','startDate','endDate')  
Example
  1. select DATEDIFF(dd,'2017/2/3','2018/3/5'as TotalDays  
  2. select DATEDIFF(MM,'2017/2/3','2018/3/5'as TotalMonths  
  3. select DATEDIFF(YYYY,'2017/2/3','2018/3/5'as Totalyear  
  4. select DATEDIFF(WK,'2017/2/3','2018/3/5'as TotalWeeks  
  5. select DATEDIFF(HH,'2017/2/3','2018/3/5'As TotalHours  
  6. select DATEDIFF(MI,'2017/2/3','2018/3/5'As TotalMin   
Result
 
Date And Time Functions In SQL Server 
 
Example 1
 
How we find the difference between row values of a column.
 
Create a Table,
  1. createtable Userdate(ID int identity,birthdate date)  
Add some value in the Table,
  1. insert into Userdate values('1994/12/30')  
  2. insert into Userdate values('1995/7/4')  
  3. insert into Userdate values('2000/9/1')  
  4. insert into Userdate values('1999/12/30')  
Now find the difference. Use this query:
  1. select a1.birthdate ,datediff(day,a1.birthdate,a2.birthdate)as DobDiff from Userdate a1 inner join Userdate a2 on a2.id=a1.id+1  
Result
 
Date And Time Functions In SQL Server 
Datepart()
It returns  day, month, and year values from the given date expression
 
Example
  1. select DATEPART(day,getdate()) as Days  
  2. select DATEPART(MM,getdate()) as Month  
  3. select DATEPART(YYYY,getdate()) as Year  
  4. select DATEPART(WK,getdate()) as Weaks  
  5. select DATEPART(HH,getdate()) as Hours   
Result
 
Date And Time Functions In SQL Server
Summary
In this article we learned datetime functions in SQL Server. Datetime functions are pre-defined functions of SQL.
Read More »

Monday, April 1, 2019

asp net mvc tutorial step by step for beginners with examples


asp.net mvc tutorials

Asp.net MVC tutorials sponsored by all tech geeks. this tutorial provides all articles in one container. it helps you like the index of the book. what is MVC ?. it is an architectural design pattern and stands for Model View and Controller. this container covers all topics of the asp.net MVC. it helps from freshers level to professional level. if you are starting level then you need basic knowledge of C#, Advanced OOPs, Visual Studio, and HTML.
it is an open source web development framework by Microsoft. it is alternate to asp.net and not the replacement of asp.net.

                                               Asp.Net MVC  - Get Started

  1. Asp.net MVC Tutorials- Get Started 
  2. Architecture
  3. First Application
  4. Folder Structure
  5. Controller
  6. Views
  7. Model
  8. Bundling
  9. View Bag
  10. Temp Data
  11. View Data
  12. Action Methods
  13. Action Selectors
  14. HTML Helpers
  15. Partial Views
  16. Layout View
  17. Filters
  18. Action Filters
  19. Validations
  20. Area
  21. What is Entity Framework and types  
  22. Creating Project in Database First Approach
  23. Creating Project in Code first approach
  24. Creating Project in Model Base First approach

Read More »

Tuesday, March 26, 2019

Sending Emails from Google Spreadsheet

google sheets are more popular nowadays. day by day the use of Apps script is increasing.
we can write the javascript to do anything like a NetSuite.Netsuite is a cloud ERP. it has only javascript development. same as google apps script also will use for all Google products (Apps) in the cloud.
google compute is the best IAAS cloud in the IT industry.

The main points in this article are to "send emails from google sheet". its very simple. and single step to do the above task.
Step 1: Login into Gmail.
Step 2: Go to google drive
Step 3: select the new button and select the spreadsheet
Step 4: type Email and name columns in the spreadsheet.
Step 5: go to tools and select the Script editor
Step 6: write the below script use where ever you want it

                                 MailApp.sendMail(to, subject, body) ;

Sending Emails from Google Spreadsheet

in the above image, you can find the function. the function name is myFunction(){}.

       myFunction()  
                   {
         MailApp.sendMail("alltechgeekz@gmail.com","Hello test mail","Hello from All Tech Geeks");
       
            }

But we need to pick email from the spreadsheet and send the mail from the sheet.

function Send Email() {

                  var sheet =SpreadsheetApp.getActiveSheet();
                  var r   = sheet.getRange("A1:B2");
                   var  customerdata=range.getValues();
for(j in customerdata)
      {
           var row=customerdata[i];
           var Email =row[0];
           MailApp.sendMail(row[1],"Email id is"+Email+,"this is test email");
      }
}

how to get data from the browser to the spreadsheet or how to use the google sheet as a database.
if we get the data from the website or anywhere. then we can do anything with that data.


Read More »

Wednesday, March 20, 2019

bind Dropdown list in asp.net

 public void bindcus()
    {
        ddlcustomer.Items.Clear();
        ddlcustomer.Items.Add(new ListItem("--SELECT--","0"));
        ddlcustomer.AppendDataBoundItems = true;
        dao.type = "CUSTOMER";
        DataTable dt= new DataTable();
        dt = bl.report(dao);
        if (dt.Rows.Count > 0)
        {
            ddlcustomer.DataSource = dt;
            ddlcustomer.DataTextField = "name";
            ddlcustomer.DataValueField = "code";
            ddlcustomer.DataBind();
        }

 
    }
Read More »