[Solved] How to return a string from a method?

Your return type is void, not string. Change it to: private string SQLSelection() A void is a “returnless” action that is performed upon something and does not “return” back the values of the return statement. If you try to return a value, you get a compiler error as you are experiencing. In addition, you keep … Read more

[Solved] What would this SQL query do?

This query creates a column called COL and puts literal value of ‘ID’ in it. It then provides the first (or highest) ID (numeric or alphabetic depending on what type of field ID is) and places it in the same row as the literal value “ID” under the column named (MAX). It then takes the … Read more

[Solved] Creating stored procedure getting Incorrect syntax near the keyword ‘Declare’

The @search should be an input parameter of the stored proc, (no Declare required), and you need an As between the signature block for the stored proc and the body of the proc. Create PROCEDURE [dbo].[usp_cloud_ClientAllSearch] @Search NVARCHAR(30) As SELECT client_Name, client_Surname, client_CompanyName, clientContact_TelephoneNo, clientContact_MobileNo, clientAddress_PostalCode FROM cloud_Client c Join dbo.cloud_ClientAddresses a ON a.client_ID = … Read more

[Solved] How to display data in JOIN, and return null value? [closed]

Use LEFT JOIN: SELECT VA.COL_PERSONNEL_NUMBER, VA.COL_CLOCK_DATE, VA.P10, VA.P20, VR.NAME, VR.UNIT FROM VIEW_ABSEN VA LEFT JOIN VIEW_REPORT VR ON VA.COL_PERSONNEL_NUMBER=VR.ID AND VR.DATE=VA.COL_CLOCK_DATE WHERE VA.COL_PERSONNEL_NUMBER LIKE ‘%521663%’ AND VA.COL_CLOCK_DATE BETWEEN ‘2016-08-01’ AND ‘2016-08-05’ 1 solved How to display data in JOIN, and return null value? [closed]

[Solved] displaying XML to html after retrieving from SQL 2014 XML column [closed]

The code would look something like the code below. You need to modify the connection string and SQL as required. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; using System.Data.SqlClient; namespace ConsoleApplication58 { class Program { static void Main(string[] args) { string connStr = “Enter Your Conneciton String Here”; string SQL = “Select … Read more

[Solved] select id by the min and max (sql) [closed]

You can use the MAX() and MIN() function to get the ids having largest and the id having smallest discount. Select id,discount from customer where discount=(select MAX(discount) from customer) OR discount=(select MIN(discount) from customer); 3 solved select id by the min and max (sql) [closed]

[Solved] SQL – Differences between two queries

The only difference is that the first query will return a row for each pair of rows in the table where P1.att2 > P2.att2 and P2.att1 = x, while the second query will just return one row for each row in the table where att2 is greater than in some row where att1 = x. … Read more

[Solved] Sql injections may be possible

It is difficult to ans your query without source code, but still try this: Try binding parameters which you pass in query instead of directly passing in it. for example: $query = UserMaster::model()->findAll(’email = :email ‘, array(‘:email’ => “[email protected]”)); Here email id is binded in an array, this will prevent sql injection to much extent. … Read more

[Solved] IF A BLANK SPACE IS PRESENT IN THE COLUMN HEADING …..AND/OR operator not working in sql statement in c# .net for modifying an excel sheet [closed]

I’m pretty sure that the problem is the space in the name of your Faculty Name column and that this has nothing to do with the use of AND or OR. Please try: sql = “Update [Sheet1$] set A1 = ‘a’ ” + “where Designation = ‘Prof(senior)’ and [Faculty Name] = ‘bob'”; 1 solved IF … Read more