Saturday, 30 November 2013

comma separated string of selected values in mysql

 
 
SELECT GROUP_CONCAT(id)  FROM table_level where parent_id=4 group by parent_id;
 
Reference from 

Tuesday, 26 November 2013

select text in textbox on focus in asp.net

<!DOCTYPE html>
<html>
<body>

<form action="demo_form.asp">
First name: <input type="text" name="FirstName" onfocus="return this.select();" value="Mickey"><br>
Last name: <input type="text" name="LastName" value="Mouse"><br>

</form>



</body>
</html>

Thursday, 17 October 2013

Tuesday, 8 October 2013

Crystal Report 8.5 with SQL Temp Table(no rowset was returned for this table, query, or procedure)

We have a stored procedure (SQL Server 2005) for a crystal reports report (8.0).
Part of this stored procedure is a fetch which combines all kind of data and puts it into a temporary table.
Then a selection is made from this temp table (usually everything is selected) and this selection is the result of the SP.

The SP works fine when called in SQL Server.
However when I want to use this SP in a CR report, it won't work.
When trying to put it into the report, it gives the message: "no rowset was returned for this table, query, or procedure."

According to one of my colleagues, this is because CR doesn't like temp tables.

However, when I leave out the temp table stuff, I get the results from the fetch, which are a dozen separate results.
When I try putting this in a CR report, it only takes the first result.

Is there a way to combine the separate results from the fetch into a single recordset, without using a temp table?

SOLUTION:


SET NOCOUNT ON  for your temp table.


 


ref: http://galahtech.stinkbugonline.com/forum/index.php?topic=12967.0 

 

Friday, 20 September 2013

Access SQL Server using Public IP


If we have Public IP (100.200.105.205) we can access sql server over internet.

First we need to run the sql browser services, then, enable TCP/IP in sql configuration tool.

Images from
http://blogs.msdn.com/b/walzenbach/archive/2010/04/14/how-to-enable-remote-connections-in-sql-server-2008.aspx

SQL Server 2008: Protocols for MSSQLServer

then we need to give the port number 1433
SQL Server 2008: TCP/IP Properties

we need to add 1433 port in external firewall (if we using) and in windows firewall
Microsoft Windows 7 Firewall with Advanced Security

New Inbound Rule Wizard - Protocols and Ports
New Inbound Rule Wizard - Protocols and Ports
New Inbound Rule Wizard - Action
New Inbound Rule Wizard - Profile
New Inbound Rule Wizard - Name





After this ,
we can access sql server using public ip without instance name.

if we using OLEDB connection type, we need to give the port number also.
 it looks like xxx.xxx.xxx.xxx,1433




 

Tuesday, 17 September 2013

Sort Control in Crystal Reports 2008?

Source:
http://www.maximumimpactsolutions.co.uk/blog/comments.asp?bd=149

In Crystal Reports 2008, a new feature, the Sort Control, has been added
The Sort Control, not only allows the end-user to sort the report by a number of fields, but also in ascending and descending order.

There are two ways that the sort control can be added to a report:

  • Directly added to the report, or
  • Assigned to a field heading of the report

Solutions:

To add a sort control directly to the report:
  1. Create the required report
  2. From the report menu, select the Record Sort Expert option
  3. In the Record Sort Expert dialog box, add the required fields for the sort controls:

    Crystal Reports 2008 Record Sort Expert dialog box
  4. Press the OK button
  5. From the Insert menu, select the Sort Control option
  6. In the Sort Control dialog box, select the required field:

    Crystal Reports 2008 Sort Control dialog box
  7. Press the OK button
  8. Click and drag on the in the required report section, to draw the Sort Control
  9. Double Click on the sort conrtol text box, to enter the label for the conrtol
  10. Click anywhere on the report to exit
  11. Press the Up or Down sort control button to sort the report


To attach a Sort Control to a Report Field:
  1. Create the required report
  2. From the report menu, select the Record Sort Expert option
  3. In the Record Sort Expert dialog box, add the required fields for the sort controls
  4. Press the OK button
  5. Right click on the field heading object, select the Bind Sort Control option
  6. In the Sort Control dialog box, select the required field:

    Crystal Reports 2008 Bind Sort Control dialog box

  7. Press the OK button
  8. Press the Up or Down sort control button to sort the report