|
database is sqlserver 2000
I use public sub
Public Sub GETSERVERNAMEANDDATABASENAME(ByVal rpt As Object)
Dim I As Integer
Dim TBL1 As New CrystalDecisions.Shared.TableLogOnInfo
TBL1.ConnectionInfo.ServerName = "Computer"
TBL1.ConnectionInfo.DatabaseName = "DataBaseName"
TBL1.ConnectionInfo.Password = "***"
TBL1.ConnectionInfo.UserID = "sa"
TBL1.ConnectionInfo.IntegratedSecurity = True
For I = 0 To rpt.Database.Tables.Count - 1
rpt.Database.Tables(I).ApplyLogOnInfo(TBL1)
Next I
End Sub
'I use the form which contain cystalreportviewer1
GETSERVERNAMEANDDATABASENAME(rpt)
Dim frm As New PrintFrm
frm.CrystalReportViewer1.ReportSource = rpt
frm.CrystalReportViewer1.Zoom(90%)
frm.CrystalReportViewer1.RefreshReport()
frm.Show()
thanks my friend
jooooo
|
|
|
|
|
Hi
how are you ya Bassem
I'm not professional on vb.net
i'm using the crystal report which is added with vb.net
and that function that you sent I think that it deal with the report which is designed by Crystal Report program...
jooooo
|
|
|
|
|
So you've create a VB.NET application , and then Added a report from the Add New Item dialog.Does your report have the extension of rdlc for example Report1.rdlc? If so then you are working with reports designed for Microsoft reporting Service.here is a good article [^]
|
|
|
|
|
Thanks Bassam ,, and I feel that you make alot for me >>
Bassam Saoud wrote: and then Added a report from the Add New Item dialog
yes
then I choose CrystalReport <<
the extention of the file is rpt for ex CrystalReport1.rpt..
Please try to help me
my work is stopped ..
jooooo
|
|
|
|
|
Thanks my firend >>
I found the answer, it that I must fill the dataset before view the report
jooooo
|
|
|
|
|
I used C# in VS 2k5. I think it should same with VB.Net.
fmRepGeneral viewerAdv = new fmRepGeneral(); // Form that contain CrystalReportViewer
crSPKAdv reportAdv = new crSPKAdv(); // Crystal Report file
reportAdv.SetDatabaseLogon("user", "pwd"); // Set the username/password
/*Important. This below line is giving the source of crystal report file.
dsResult = The dataset that will be used.
As I know you when you create crystal report file you should have the physical DataSet (.xsd),
then you get drag-drop the field you wanted in your CR with that physical DS, and the table's
name must same with 'dataset.Tables["must same"]'. In this case, I should have dataset that
contains Table 'V_RPT_SPK_ADV', otherwise the crystal report will never get the data.
*/
reportAdv.SetDataSource(dsResult.Tables["V_RPT_SPK_ADV"].DefaultView);
viewerAdv.crystalReportViewer1.ReportSource = reportAdv; //sure..u understand this line.
Hope this help.
Jati Indrayanto
Everything is possible.
|
|
|
|
|
Hi, I am using MS Sql Server
I have the following tables already in place, the tables are already done and the requirement is not to change any columns/tables structures. I have four tables:
1- Person: has person info, first, last, etc.
2- Departments: has the company departments names.
3- Meetings: has the meeting date, time, location, and two department names whom should participate.
4- NoShows: a log of the personId and meetingId for those who did not show up to the meeting.
I need a select query for selected meeting to show all personId and a field of F/T flag for each person whom showed up or no-show. I know how to do everything. Any comments are greatly appreciated.
Bit_Flipper
|
|
|
|
|
Bit_Flipper wrote: I know how to do everything. Any comments are greatly appreciated.
If you know how to do everything, exactly what do you want comments on?
|
|
|
|
|
I have writen a VBA Macro into MS Access 2002 database and I want tp run it from my ASP page instead to use a command button from MSAccess UserForm. I am looking for a ASP code to do that. This VBA Macro take the data from a database and export it to a MS Excel file by not only diplaying the data but also by creating a bar chart.
Khelil Khelil
|
|
|
|
|
Most people do not run Excel VBA macros from ASP pages (you would need to run OLE automation).
I wrote the following code a couple of years back that may help:
Sub WriteToExcel(objAdoResultSet, strTemplateFile, strNewFilePath)
Dim objFSO, objExcelConn, objExcelRS, arrData, lngRow, intField
'Copy the template spreadsheet, and open a recordset.
Set objFSO = CreateObject("Scripting.FileSystemObject")
Call objFSO.CopyFile(strTemplateFile, strNewFilePath, True)
Set objExcelConn = CreateObject("ADODB.Connection")
Call objExcelConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strNewFilePath & ";" & _
"Extended Properties=""Excel 8.0;HDR=NO""")
Set objExcelRS = CreateObject("ADODB.RecordSet")
Call objExcelRS.Open("SELECT * FROM [Sheet1$]", objExcelConn, _
adOpenKeyset, adLockOptimistic)
Call objExcelRS.MoveLast() 'Position cursor on formatting row.
'Write data to the spreadsheet recordset.
arrData = objAdoResultSet.GetRows()
With (objExcelRS)
For lngRow = 0 To UBound(arrData, 2)
Call .AddNew()
For intField = 0 To UBound(arrData, 1)
.Fields(intField).Value = arrData(intField, lngRow)
Next
Call .Update()
Next
End With
'Tidy up.
Call objExcelRS.Close()
Set objExcelRS = Nothing
End Sub I have simplified it a bit to make it shorter, and haven't tried running it since. The general principle is that it uses the JET driver to open a writable connection to an Excel spreadsheet, then copies the contents of the passed-in objAdoResultSet into your new connection.
Hope this helps.
Andy
|
|
|
|
|
<u></u>here is my app.config file
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" />
</configSections>
<dataConfiguration defaultDatabase="SqlConnection" />
<connectionStrings>
<add name="SqlConnection" connectionString="server=Developer;database=MSPetShop;Integrated Security=true;"
providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
first i m getting these two errors:
Message 1 Could not find schema information for the element 'dataConfiguration'.
Message 2 Could not find schema information for the attribute 'defaultDatabase'.
and when i try to call the from my DAL layer i got exception
i m using this funcion
Database db=DatabaseFactory.CreateDatabase();
I hope any one there will reply me many thanks,
adnan
|
|
|
|
|
adnanrafiq wrote: first i m getting these two errors
They are not errors they are messages (it even tells you they are messages). It means that the build process cannot verify if what you have written is valid or not.
adnanrafiq wrote: when i try to call the from my DAL layer i got exception
So, what is the exception? You've just indicated on what line you get the exception without telling us what it was.
|
|
|
|
|
At first glance it looks like the enterprise library is eithe rnot installed or incorrectly installed?
|
|
|
|
|
suppose there are two table called tableA and tableB and the situation is the primary key of tableA is a foreignkey of tableB and the primary key of tableB is a foreignkey of tableA.in this type of situation how we can insert data into 2 tables called tableA,tableB.pls tell me how can i handle this situation very efficiently.explain in detail........plzzzzz.
tbhattacharjee
|
|
|
|
|
Well, I would create a new table say "tableC"(pkA,pkB) which will hold the relation between your two tables and do the insert in it Last. So insert first in Table A then B and last in C.
There are other ways to do it ofcourse...
|
|
|
|
|
Hello,
I am attempting to select all users who are visiting our site with multiple IPAdresses. I wrote the query below but it is not doing what I want it to do. Any assistance in accomplishing this task will be greatly appreciated.
Select UserID from AU_commontable
where UserID IN if exists(Select ipaddress as IP, count (ipaddress )as Total --, userID,logdate
from AU_commontable
where result=1 and actiontaken='firsttimesignon'
group by ipaddress
having (count(ipaddress)>1))
Skan
If you knew it would not compile why didn't you tell me?!?!?!
|
|
|
|
|
select userid,ipaddress, count(1) as[number of unique ipaddress]
from AU_commontable
where result=1
and actiontaken='firsttimesignon'
group by userid,ipaddress
having count(1)>1
|
|
|
|
|
Hi Guys,
I want to compare three columns on each row and get the maximum value. I tried using GREATEST(col1,col2,...) function but it didn't work (I hve SQL version 8.0 installed). Is there any way to get max of several colunms per row? Here is how it should look like.
===========================================================
ID, measurement_01, measurement_02, measurement_03, maximum
===========================================================
1, 300, 350, 325, 350
2, 225, 275, 400, 400
3, 100, 500, 300, 500
===========================================================
I'll appreciate any help
Thanks
-- modified at 16:06 Friday 26th January, 2007
|
|
|
|
|
What database-engine and front-end tool are you using?
|
|
|
|
|
Its SQL server 2000. SQL Query Analayzer version 8.0
|
|
|
|
|
The easiest way (assuming you only need the maximum of 2 columns) would be:
select id, measurement_01, measurement_02, measurement_03,
case
when measurement_01 >= measurement_02 and measurement_01 >= measurement_03
then measurement_01
when measurement_02 >= measurement_03
then measurement_02
else measurement_03
end as maximum
from #temp_ajh
order by id
Regards
Andy
|
|
|
|
|
Or you can flatten the table (as it should have been designed in the first place).
SELECT
m.ID,
m.measurement_01,
m.measurement_02,
m.measurement_03,
MAX (FlatTable.measurement_01)
FROM
MeasurementTable m
INNER JOIN
(SELECT ID, measurement_01
FROM MeasurementTable
UNION
SELECT ID, measurement_02
FROM MeasurementTable
UNION
SELECT ID, measurement_03
FROM MeasurementTable) AS FlatTable
ON (m.ID = FlatTable.ID)
GROUP BY
m.ID,
m.measurement_01,
m.measurement_02,
m.measurement_03
|
|
|
|
|
Both solutions are perfect! Thank you very much for your answer.
-- modified at 17:21 Friday 26th January, 2007
|
|
|
|
|
How can i crate aint value that will display the value as 0001 to 9999
without omitting the zeroes
Thanks
javierarka
|
|
|
|
|
In SQL-Server:
set @myString = Right('0000' + Convert(varchar(4), @MaxKey), 4)
In VbScript:
myString = Right("0000" & intNumber, 4)
|
|
|
|