Skip to main content

Posts

Showing posts with the label SQL

Featured Post

How to create customizable products in Shopify for Free (No coding!)

Creating customizable products in your Shopify store not only increase your customer satisfaction, it also increases your conversion rate.  Here is a method to add custom options for your Shopify product and convert it into personalized product - Go to Shopify store page and search for "Advanced Product Customizer" app or you can directly the the Shopify app page by clicking on this link Advanced Product Customizer . Install  Advanced Product Customizer  app for free in your Shopify store  From the application dashboard, enable to app embed block to complete the installation process Click "Product Custom Options"  From the Shopify products list, select the product on which you want to add custom options. Advanced Product Customizer  offers Image Swatch, Color Swatch, Text box, File Upload, Radio, Checkbox, Date Picker and more. Here is the a demo video for adding custom option for a Shopify product -

Prepared Statements for Database driven application

Prepared Statement is commonly used by application to execute the same parameterized SQL statement again and again. Prepared statements are compiled only once. If we need to execute a statement multiple times then execution of prepared statement is faster as it is compiled only once, while in case if we are using direct statements then each statement is first compiled every time before execution. So, time taken in Prepared execution is lesser as compared to the time taken in direct execution. Prepared statement are also known as parameterized queries. Parameterized queries and prepared statements are features of database management systems that basically act as templates in which SQL can be executed. Example of Prepared Statement using Java and C# We are using Emp table. Here "id" is the primary key of the table. Following query will retrive all the data of a row for id =1 SELECT * FROM Emp WHERE id =1 Now, if we create a template of above statement and use that fo...

Paging in MS SQL Server 2005/2008 using ROW_NUMBER()

Sometimes we need to implement paging functionality in our database. We can use ROW_NUMBER() function for this purpose. ROW_NUMBER function is one of the ranking function of SQL Server. Here is an example of ROW_NUMBER - SELECT * FROM (SELECT ROW_NUMBER() OVER(ORDER BY EmpID) AS Row, * FROM Employee AS tbl ) WHERE Row >= 1 AND Row <= 10 ROW_NUMBER is used for assigning sequential numbers to the records of record-set. In the above query a sequel number is assigned to each record of the Employee table. Here we have used following two clause - OVER clause - It is used for specifying the ordering of records before assigning the sequence to each record. ORDER clause -  In order clause we define column or columns which is used to order the records in the record-sets. In our case we have used EmpId with ORDER clause, so first each record of Employee table is first ordered  according to EmpId and then sequence number is assigned to e...

Storing Image url in MS Sql database

For fast loading of images we can store the location of the image rather than the storing the image itself. Following can be used to store image url in the database - p rotected void Button1_Click(object sender, EventArgs e)         {             if (FileUpload1.HasFile)             {                 string imagepath = "~/images/" + FileUpload1.PostedFile.FileName;                 string strcon = ConfigurationManager.ConnectionStrings["con"].ConnectionString;                 SqlConnection conn = new SqlConnection(strcon);                 conn.Open();                 SqlCommand cmd = new SqlCommand("INSERT into Image (name, image) VALUES (@name, @image)", conn);       ...