|
Stored procedures are often the best way to go, but you will be limited in how you can create your SQL statements. A stored procedure has to be able to be compiled when saved, which means the compiler needs to know the fields to retrieve/update and the criteria to use when exucuting the procedure. With highly dynamic SQL, this is often not an option.
In short, use a stored procedure if possible. Another option is to create SQL views and call those to retrieve data. If you're going to process the views though (i.e. retrieve a subset of data from a view), wrap that code in a stored procedure if possible.
james
commercial developer, author, speaker, dude.
www.jamesfoxall.com
|
|
|
|
|
I am writing a program that display a report with the help of Crystal report.
My main report is very fine but my 2 sub reports wouldn’t show data. What is wrong?
Also I have two logos on the report. One of them is constant but the other a .jpeg file needs to be changed at run time. How can I do this?
I am using crystal Report XI and my database is in MS Access.
Thanks you for your help.
ihe
|
|
|
|
|
Check the joins of your query providing the data to your sub reports. Chances are you have linked 2 or more tables together, but one of them has no related data. If this is the case, then change the link to Always show data from the main table.
Steve Jowett
|
|
|
|
|
Please your explanation is unclear to me.
The query for the main report is
SELECT ComplusoryFields.CFactor, ComplusoryFields.MudWeight, ComplusoryFields.CirculationRate, ComplusoryFields.CurrencyForMudCost, ComplusoryFields.WellName, ComplusoryFields.ReportType, ComplusoryFields.DataDate, DataIdentity.DataID, ActivitityRemarks.Remark, DrillingMudProperty.Alkanity, DrillingMudProperty.API, DrillingMudProperty.Chlorides, DrillingMudProperty.FlowLineTemperature, DrillingMudProperty.Gel0Mins, DrillingMudProperty.Gel10Mins, DrillingMudProperty.HTHPFilterates, DrillingMudProperty.MBT, DrillingMudProperty.YP, DrillingMudProperty.PV, DrillingMudProperty.MudWeightIn, DrillingMudProperty.MudWeightOut, DrillingMudProperty.Water, DrillingMudProperty.Solids, DrillingMudProperty.Oil, DrillingMudProperty.AveROP, DrillingMudProperty.MaxROP, DrillingMudProperty.VIS, DrillingMudProperty.ShaleDensity, DrillingMudProperty.ShaleFactor, DrillingMudProperty.FlowLineTemperatureScale, DrillingMudProperty.pH, MudWeightChanges.Depth, MudWeightChanges.OldMW, MudWeightChanges.NewMW, PressureLosses.DxC, PressureLosses.EMWLOT, PressureLosses.EstOverBalance, PressureLosses.EstFratureLoss, PressureLosses.EstPorePressureLoss, PressureLosses.MWDPressureLoss, PressureLosses.PipeRunSpeed, PressureLosses.CasingShoePressureLoss, PressureLosses.DxTrend, PressureLosses.EMWLOT2, PressureLosses.EstFratureLoss2, PressureLosses.EstPorePressureLoss2, PressureLosses.HydrostaticsPressure, PressureLosses.HydrostaticsPressure2, ReduceCirculatingRates.Pressure, ReduceCirculatingRates.SPM, ReduceCirculatingRates.Pump, Reports.ADT1, Reports.ADT2, Reports.Operator, Reports.Contractor, Reports.TVDDepth, Reports.MDDepth, Reports.Rig, Reports.Operation, Reports.ImagePath, Reports.SpudDate, ComplusoryFields.MudCost_Notes, ComplusoryFields.MudCost_Coins
FROM Reports RIGHT JOIN ((PressureLosses RIGHT JOIN (MudWeightChanges RIGHT JOIN (DrillingMudProperty RIGHT JOIN (ActivitityRemarks RIGHT JOIN (ComplusoryFields RIGHT JOIN DataIdentity ON ComplusoryFields.DataID = DataIdentity.DataID) ON ActivitityRemarks.DataId = ComplusoryFields.DataID) ON DrillingMudProperty.DataID = DataIdentity.DataID) ON MudWeightChanges.DataID = DataIdentity.DataID) ON PressureLosses.DataID = DataIdentity.DataID) LEFT JOIN ReduceCirculatingRates ON DataIdentity.DataID = ReduceCirculatingRates.dataId) ON Reports.DataID = DataIdentity.DataID;
The query for the subrepotA is
SELECT DataIdentity.DataID, DrillingPumps.PumpNumber, DrillingPumps.RodDiameter, DrillingPumps.StrokeLength, DrillingPumps.Efficency, DrillingPumps.PumpOutPut, DrillingPumps.PumpSize, DrillingPumps.LinearDiameter, DrillingPumps.PumpType, DrillingPumps.PumpStatus, ComplusoryFields_1.DataDate, ComplusoryFields_1.ReportType, ComplusoryFields_1.CurrencyForMudCost, ComplusoryFields_1.CirculationRate, ComplusoryFields_1.MudWeight, ComplusoryFields_1.CFactor
FROM DataIdentity LEFT JOIN (DrillingPumps RIGHT JOIN ComplusoryFields AS ComplusoryFields_1 ON DrillingPumps.DataID = ComplusoryFields_1.DataID) ON DataIdentity.DataID = ComplusoryFields_1.DataID;
And The query for the subrepotB is
SELECT BottomHoleAssembly.HoleOrCasingType, BottomHoleAssembly.HoleInnerDiameter, BottomHoleAssembly.PipeOrCollarType, BottomHoleAssembly.PipeInnerDiameter, BottomHoleAssembly.PipeOuterDiameter, BottomHoleAssembly.PipeAndCasingLength, ComplusoryFields.CFactor, ComplusoryFields.MudWeight, ComplusoryFields.CirculationRate, ComplusoryFields.CurrencyForMudCost, ComplusoryFields.WellName, ComplusoryFields.ReportType, DataIdentity.DataID
FROM (BottomHoleAssembly RIGHT JOIN ComplusoryFields ON BottomHoleAssembly.DataID = ComplusoryFields.DataID) RIGHT JOIN DataIdentity ON ComplusoryFields.DataID = DataIdentity.DataID;
All tables are joined by a DataID .The DataIdentity table suppies the DataID to use
ihe
|
|
|
|
|
I have been looking into creating a calculator that requires the user to type in what they want solved. Not order, no clicking buttons, and no parentheses. They type everything in, click a button, and poof. They get their answer. Obviously, this needs to follow the order of operations (PEMDOS). For the time being, i am not doing square roots or powers. I would like the user to be able to type in the stuff they want solved in infix notation, while it should be solved using RPN. I have problems coming up with code to convert it- probably because i dont entirely understand the conversion. Here is a link to what i found, which pretty much spells it out.
http://en.wikipedia.org/wiki/Shunting_yard_algorithm[^]
If anyone could help me with the code to convert infix notation to RPN, i would be very thankful. As of right now, this is what i have.
<br />
equation = txtequation.text<br />
length = len(equation)<br />
for i = 1 to length<br />
temp = mid(equation,i,1)<br />
tempstack.add temp<br />
output = output & temp<br />
next i<br />
but of course, that doesnt move stuff around.
|
|
|
|
|
I created a new class and inherited the windows combobox. I also created a TextChanged event for the combobox. Then compiled it into a dll. When I use the combobox in a windows project the TextChanged event does not fire. What do I need to do to get it to work?
|
|
|
|
|
Can you post your TextChanged event code? It might have to do with the way you are handling it (overloads, shadows, etc.)
james
commercial developer, author, speaker, dude.
www.jamesfoxall.com
|
|
|
|
|
Public Class Class1
Inherits System.Windows.Forms.ComboBox
Public WithEvents ComboBoxMain As New System.Windows.Forms.ComboBox
Public Sub ComboBoxMain_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs)
End Sub
End Class
When the class is used in a windows project the gotfocus event never fires. What do I need to do to get this to work? Thanks.
|
|
|
|
|
Here's what appears to have happened:
You inherited a combo box - this is good. However, now your entire control is the combo box; you don't need to create another. You have also declared a combo box variable, but there is no need to do this and it will never fire because you haven't added the combo box to the Controls collection and therefor it isn't visible in the UI.
Try this:
1. Take out the Public Sub and Public WithEvents statements (and the End Sub, of course).
2. In the object drop down in the upper-left corner of the code window, select (Class 1 Events).
3. In the event drop down list in the upper-right corner, select GotFocus.
You will now have a GotFocus event that will fire appropriately.
|
|
|
|
|
That worked perfectly.
Thanks a lot!
|
|
|
|
|
You're welcome.
|
|
|
|
|
One other question about this. My combobox class has a gotfocus event. I drop that combobox class onto a form and create a gotfocus event in that form. Which gotfocus event runs first, the one back in the defining combobox class or the one in the form?
|
|
|
|
|
The one you defined in your class will fire before the event on the form.
|
|
|
|
|
Hi vb experts, I am jayachandra,
can anybody help me ? How to send the data from excel/access to oracle database through VB6 programatically? can anybody give thd code? please....
I will be thankful to you,
Jayachandra
|
|
|
|
|
how can i set class name of a desktop application in vb.net
i've tried to use CreateParams.Classname but error suggests
class name is not registered.
for that i've used
following apiz...
//start
Public Declare Function RegisterClass Lib "user32" Alias "RegisterClassA" (<marshalas(unmanagedtype.struct)> ByRef Class As WNDCLASS) As Integer
<structlayout(layoutkind.sequential)> Public Structure WNDCLASS
....
end structure
//end
mycls.lpszClassName = "myclass"
MsgBox(RegisterClass(mycls))
Dim Params As CreateParams = New CreateParams
Params.Caption = DOCSVAULT_IDENTITY_SMB
Params.ClassName = clsDVSMB.lpszClassName
Me.CreateHandle(Params)
still its givin error.. how to register class and set my applications class?
"You can do any thing you set to your mind" - theGhost_k8
|
|
|
|
|
the below is an example of what you want.
<ProgId("DLLNAME.CLASSNAME"), Guid("C4CAB66D-291F-4bd7-9D5C-2E417AB75F49"), ComVisible(True), ClassInterface(ClassInterfaceType.AutoDispatch)> _
Public Class CLASSNAME
end public
|
|
|
|
|
Sir,
Can i programically find whether the sql server is installed or not in vb.net 1.1
Thanks
|
|
|
|
|
Sir,
Please explain the difference between byval and byref.
Thanks
|
|
|
|
|
ByVal passes an argument to a method, well, by Value. It passes the actual value of the argument to the method you're calling by pushing that value on the call stack. When the method gets control, it pops the values off the stack and uses them.
ByRef passes an argument by pointer. Instead of passing the value, it passes an address to the value stored in memory somewhere. The addess is pushed onto the stack and passed to the method, which pops that address off the call stack, and now knows where in memory to find the value.
You can find out more here[^].
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I have a question about right mouse click popup menu in IE.
I try write a program that add a new item into popup menu's items(I want program popup menu).but i don't know any thing about this .
please help me .
computer
|
|
|
|
|
That's called a "Context Menu" or "Context Menu Strip".
|
|
|
|
|
Hi i am a beginer plz give me a answer
How d comm take place b/w Business layer,Presentation Layer in 3.Tier implementation
Thanks...
|
|
|
|
|
Simple class instantiation and method calls. There's no magic going on between layers.
Dim myBusObj As New BusinessObject
myBusObj.ValidateSomeData(data)
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi,
I have a stored procedure and it is returning a table as a result.
How can i call d proc & Capture table from Vb.Net using Connected arch
Thanks...
|
|
|
|
|
Hi
You can retieve data using a stored procedure in the same way as any other query. There is other (more optimal) ways to retrieve data using a SP, but this is the simplest.
Example:
'---Create Connection
Dim ConnectionString As New SqlClient.SqlConnectionStringBuilder
ConnectionString.DataSource = "localhost" 'ServerName
ConnectionString.InitialCatalog = "MyDataBase" 'DatabaseName
ConnectionString.IntegratedSecurity = True
'Open Connction
Dim Connection As New SqlClient.SqlConnection(ConnectionString.ConnectionString)
Connection.Open()
'---Create/Open Reader
Dim Reader As SqlClient.SqlDataReader
Dim Command As System.Data.SqlClient.SqlCommand = New System.Data.SqlClient.SqlCommand("MyStoredProcedureName", Connection)
Command.CommandType = CommandType.StoredProcedure 'Optional
Reader = Command.ExecuteReader
While Reader.Read
MsgBox("Field 0 :" & Reader.Item(0).ToString)
MsgBox("Field 1 :" & Reader.Item(1).ToString)
End While
'Close Reader
Reader.Close()
'Close Connection
Connection.Close()
|
|
|
|
|