Friday, February 24, 2012

how to colum the page?

Good day!

can any one help me how to colum the page? example i have three colums in the page if the data exceed in the first colum it wil go to the second colum then 3rd colum.

Can any one hlp me. Your help is greatly appreciated

See this article in MSDN:

http://msdn2.microsoft.com/en-us/library/ms155816.aspx

How to color alternate row ?

Hey all...
I would like to apply back ground color to alternate row so is it possible ?? how ?
ThanksSection expert, color tab, click background color formula box and enter something like

if recordnumber mod 2 = 0 then crSilver else crNoColor|||Thank you very much JaganEllis...

It works for me ...|||But when I export my report in excel sheet it gives me file without background color so how can I get same background color if I export my report in EXCEL?

Thanks|||How are you doing the export?
I believe you can choose to export just the data, or the formatting too.
Certainly works OK for me when I choose File.Export.Export Report and choose the format as the non Data only Excel option, to the application.|||I am exporting manually and what I am doing in crystal report is after previewing my report I go to File menu -> Print -> Export

And to export in Excel I have 2 options to choose from so first one Excel 8.0 (XLS) and 2nd one is Excel 8.0 (XLS) (Extended)

But in none of them I am able to export format too..|||Did you select Data only option? Dont Choose that option

How to Collete a database?

How to Collete a database? What is the code?

Example:

I had have two database, and the two database have two table which are similiar same but the data are some different. It mean, the two table should have the same data, but there are miss another one. How to make the data same to each other in the two table?

Thanks.If I understood you well, the solution might be very simple or impossible.

Simple solution: you KNOW which of two tabes contains correct data. Delete all "wrong" data from the table and insert "correct" data into it.

(Almost) impossible solution: correct data can be found in both tables. Do you know which of them are correct and which are wrong? If so, you could create third table and insert only correct data from both tables into it; delete all data from original tables; insert data from third table into original ones.

Impossible solution: if there's no obvious WHERE clause which distincts correct records (or even columns?) from wrong ones, you're in deep trouble.|||no... i think you misundestand my meaning

example:
table1 have 1,2,4,9...
table2 have 1,3,5,7,8,....

and i want be like this:
table1 have 1,2,3,4,5,7,8,9...
table2 have 1,2,3,4,5,7,8,9...

so, how?????

thanks.|||I see ... syntax might be like this (it may differ regarding your DB engine):

CREATE TABLE temporary_table AS SELECT * FROM first_table;

INSERT INTO first_table SELECT * FROM second_table;

INSERT INTO second_table SELECT * FROM temporary_table;

DROP temporary_table;|||i not understand...
i am beginner...
Please explain more... or give me the code more complete

thanks.|||What is your DB engine? When talking about "two databases" - are they really databases or are they schemas in the same database?

If those are different databases, you'll have to create some kind of a database link between them to be able to transfer data.
If we're talking about schemas in the same database, simple privilege grant would be enough.

Code I wrote IS the complete code; I don't know what to add. Perhaps just to say it in English?
- first create a temporary table to store data from the first table
- take all records from the second table and insert them into the first table. Now the first table contains all data you need.
- take all records from temporary table (actually, the original first table) and insert them into the second table. Now the second table contains all the records too.
- drop temporary table.|||I store one of the database in pendrive(in mdb format) and the other one in ms sql server.

However, I still do not know how to create a temporary table. But I also have a doubt, if "I take all records from the second table and insert them into the first table. Now the first table contains all data you need.", then the first table will have the repeating record.... I do not want the repeating record.

Thanks.|||Oh, of course you'll have repeating records! I missed that "1" :) Sorry!

OK then; here's another attempt: ("temporary table" is, in this case, created as selection of all record from some table). UNION will create distinct records from both tables:

CREATE temporary_table AS
SELECT * FROM first_table
UNION
SELECT * FROM second_table;

DELETE FROM first_table;
DELETE FROM second_table;

INSERT INTO first_table SELECT * FROM temporary_table;
INSERT INTO second_table SELECT * FROM temporary_table;

DROP temporary_table;

EDIT: This might be OK, I guess ... however, I've never heard of "pendrive(in mdb format)" you're talking about. Keep that in mind reading my code - it might not be usable on "pendrive" (whatever it is).|||Thank you very much.

After your teaching, I just realize have "union" thning. Pendrive (hardware) is a something to store file, same as external hardisk. However, I will try to do what you teach me.

Thank again.|||However, I have try but got many mistake, cause i am beginner, and not quick understanding sql.
below is my code:

Dim con As New ADODB.Connection
Dim objRS As New ADODB.Recordset
Dim conC As New ADODB.Connection
Dim objRSC As New ADODB.Recordset

Const lsDSN = "Provider=sqloledb;" & _
"Network Library=DBMSSOCN;" & _
"Data Source=xxx.xxx.68.xxx,1433;" & _
"Initial Catalog=abc;" & _
"User ID=sa;" & _
"Password=axxxxxx"

Const lsDSNC = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=F:\MyLife.dat;" & _
"Jet OLEDB:Database Password=xxxxxx"

con.Open lsDSN
SQL = "SELECT * FROM History order by Dtime asc"
objRS.Open SQL, con, , 3

conC.Open lsDSNC
SQLC = "SELECT * FROM History order by Dtime asc"
objRSC.Open SQLC, conC, , 3

Create temporary_table
SQL
Union
SQLC

DELETE FROM SQL;
DELETE FROM SQLC;

INSERT INTO SQL SELECT * FROM temporary_table;
INSERT INTO SQLC SELECT * FROM temporary_table;

DROP temporary_table;

objRS.Close
Set objRS = Nothing
con.Close
Set con = Nothing

objRSC.Close
Set objRSC = Nothing
conC.Close
Set conC = Nothing

i using vb6 to create a *.exe. How to fix it?

Thanks.|||Unfortunately, I'm a tabula rasa regarding Visual Basic ... I'll be glad to help you further with SQL part of the solution, but let's hope someone else will know how to help you with this part of the problem.|||have a look at the COALESCE function.

SELECT COALESCE(t1.yourField, t2.yourField) as finalField
FROM t1 INNER JOIN t2 On t1.key = t2.key

How to collapsible a column when the report was designed in table mode?

Hi folks, I'm trying to collapse a column on a report that's designed in table mode. I was trying to mimick what happens in a matrix where you have a column that has a '+' in it that makes toggles the visibility of a column to its immediate right (The reason I'm not using Matrix mode is I continually get "out of memory" errors on the report I'm generating.).

When I select the column and mark visible to 'false' in the properties, it of course asks me for a TextBox. My problem is that I am unable to find a scenario where the textbox is "in the proper group". Is this something that's supported, and if so, I'd appreciate some pointers to lead me in the right direction.

Thanks.bump.. anyone have any clues?|||

I was able to get this to work fine in RS 2005. Where is the textbox that you are setting as the ToggleItem for the table column? I selected the textbox in the table header cell immediately to the left of the column that I wanted to toggle. What is the exact error you are seeing?

-Chris

|||Chris, thanks for your reply. My problem is I was selecting the whole column and trying to toggle the visibility on that. You can't do that; you've got to set the visibility on each portion individually (column header, group, detail). Thanks again.|||

Hi Aquineas..

I needed to do the same and managed to get it to work...

Create a text box outside of the table in the mainreport - with suitable text... Show / Hide Detail

and name the text box = ToggleColumns

Now highlight the column in the table and select the ToggleItem under Visibility and type ToggleColumns.

It works for me - even though the ToogleColumns isn't available in the list.

Cheers

Michael

|||I am having the same problem as Aquineas, I took Michael's suggestion but it doesn't seem to work for me. Having done what Micheal has suggested, I hides the column period and there is no way of getting it back on run time. I think I follow the instruction carefully. I am still looking for more suggestion.

How to collapsible a column when the report was designed in table mode?

Hi folks, I'm trying to collapse a column on a report that's designed in table mode. I was trying to mimick what happens in a matrix where you have a column that has a '+' in it that makes toggles the visibility of a column to its immediate right (The reason I'm not using Matrix mode is I continually get "out of memory" errors on the report I'm generating.).

When I select the column and mark visible to 'false' in the properties, it of course asks me for a TextBox. My problem is that I am unable to find a scenario where the textbox is "in the proper group". Is this something that's supported, and if so, I'd appreciate some pointers to lead me in the right direction.

Thanks.bump.. anyone have any clues?|||

I was able to get this to work fine in RS 2005. Where is the textbox that you are setting as the ToggleItem for the table column? I selected the textbox in the table header cell immediately to the left of the column that I wanted to toggle. What is the exact error you are seeing?

-Chris

|||Chris, thanks for your reply. My problem is I was selecting the whole column and trying to toggle the visibility on that. You can't do that; you've got to set the visibility on each portion individually (column header, group, detail). Thanks again.|||

Hi Aquineas..

I needed to do the same and managed to get it to work...

Create a text box outside of the table in the mainreport - with suitable text... Show / Hide Detail

and name the text box = ToggleColumns

Now highlight the column in the table and select the ToggleItem under Visibility and type ToggleColumns.

It works for me - even though the ToogleColumns isn't available in the list.

Cheers

Michael

|||I am having the same problem as Aquineas, I took Michael's suggestion but it doesn't seem to work for me. Having done what Micheal has suggested, I hides the column period and there is no way of getting it back on run time. I think I follow the instruction carefully. I am still looking for more suggestion.

how to code sql comments within sql statement


I want to write a query like this:

select ' select count(*) '+ '/*' + table_name + '*/' + char(10) + ' FROM '+table_name...

The result should looks like this:

--
select count(*) /* - emp_name */
FROM emp_name

query result:

COUNT(*)-EMP_NAME
-
3

-
But, now I can only got

COUNT(*)
-
3

What's wrong with my original code?Actually, I am getting


- as the result, I think I just need to find out how to turn headings on.
3

Thanks|||

Well... you are comment out whatever is written. Comment out means that it will be ignored, it will not show up in the results, etc.

It looks like you want to create column headers for aggregrated columns. Fortunately, you can use an ALIAS for that task.

For example:

Code Snippet


SELECT
count(*) AS 'count(*) --Emp_Name'
FROM MyTable

Of course, whatever is typed as the ALIAS has to be know in advance, it will not dynamically put in the column or table name.

|||
Thanks, Arnie:

I got it now.

How to code DateTime-Literal in SQL Server

Hi,

I'm a newbee to SQL Server. I have a very simple question to you experts: How should I code a literal of the "datetime"-Datatype? For Example in the VALUES-clause of an SQL-statement. I have tested several "formats" ('20.04.2006 11:15:00' with an 4-digit year enclosed in single apostrophes) but all i earned is an exception!

Any help very appreciated!

Thanks in advance and best regards

Reiner

PS.: I'm using a german-localized database (thus the date-format dd.MM.yyyy).

I am not familiar with the german localized database, but I have some guesses...

You are doing the right thing, dates in SQL are inclosed by single '. Are your clients localized with the same culture as the database? Is so you should be able to

strsql = "INSERT INTO TABLE VALUES('" & datetime.tostring() & "')"
and the tostring method with format it properly.

Also try it with - instead of . in the date.

What I would do is open SQL Query Analyzer and write out the SQL insert query with a date and keep modifying the date format until it accepts it.

If none of this is a help then post the exception message.
|||

Look up date and time formats in books online. There are some ISO date time formates that are the best practice. Generally speaking, the formats are:

YYYYMMDD or YYYY-MM-DD

then time:

HH:MM:SS.SSS

There are variations, but the most important bits have to do with the year month date arrangement that is not ambiguous in any country

|||

There are only two unambiguous formats (one for date and another for datetime). Both are ISO formats.

YYYYMMDD - ISO unseparated date format

YYYY-MM-DDThh:mm:ss.nnn[ Z ] - ISO 8601 timestamp format (note there is no space after and before Z. I have to do it to prevent a stupid icon from showing up and there seems to be no way to prevent formatting.)

The ISO 8601 format is supported only from SQL Server 2000 onwards. Any other format interpretation depends on the language / session settings.