Interact with SQL database

C

Carlos

Hello everybody,

I have made a form (new from Data Connection)with a data connection SQL
database. I have created a data source without any table, and an SQL
statement, the following:

SELECT DISTINCT t.Ticket
,t.Updated_By AS Ticket_Updated_By
,a.Updated_By AS Activity_Updated_By
,t.Summary
,t.Status
,count(*) as Num_Activities
FROM HD_Tickets t
JOIN HD_Ticket_Activity a
on t.ID = a.Ticket_ID
WHERE a.ID IN (SELECT a.ID
FROM HD_Ticket_Activity a
WHERE a.Ticket_ID = t.ID
AND a.Updated_By IN ('juan justo')
-- AND cast(floor(cast(a.Submit_Date as float)) as datetime)
-- BETWEEN CONVERT(datetime,'2006-01-23',120)
-- AND CONVERT(datetime,'2006-01-23',120)
)
GROUP BY t.Ticket
,t.Updated_By
,t.Summary
,a.Updated_By
,t.Status

The form is working properly, but I have a question, I would like Infopath
to ask me for some data before doing the 'query', for instance he
'Updated_By' and Dates that are shown in the SQL statement, I really don't
know how to integrate them,

any advise will be really appreciated,
The best regards,
Carlos
 
S

Sandeep

Hi Carlos

This is C# code.
Write this code before the query code.

if( (Updated_By == null || Updated_By.Length == 0) && (Dates == null ||
Dates.Length == 0))
{

thisXDocument.UI.Alert(string.Format("{0} enter your mesage here {1} ",
Updated_By ,Dates));

}

I hope this will help U.

Sandeep
www.autonomysystems.com
 
C

Carlos

Hello, thanks Sandeep, I dind't suppose that programming was neccesary, I'm a
newbie in infopath (also in programming) and I thought this funcionality was
possible in another way.

I will try with my colleagues here, maybe they can arrange this,

Anyway thanks very much and the best regards,
Carlos.
 
Top