|
Stop even thinking about using the config file. App.config and web.config files have elements that should never be exposed to end users. For the application, as you have described it, it is not the best tool to use. Use an external file with a defined schema that you can serilaize of read with XmlDocument.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Dears,
Iam new to vb.net,please help me to pass parameter to for my VB.net project,
I want to pass @Ridfrom to SP:usp_Procedure and return value to @PidTo .
The below mentioned is my codings.can u susggest a way to solve the error
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
Dim combo As String
Dim SQLEV As SqlClient.SqlConnection = New SqlClient.SqlConnection
SQLEV.ConnectionString = "Persist Security Info=False;Integrated Security=SSPI;database=db_chart;server=nrppc-mis1\sqlexpress"
combo = ComboBox1.SelectedValue.ToString
Dim command As New SqlCommand("usp_Procedure", SQLEV)
Dim adapter As New SqlDataAdapter(command)
command.CommandType = CommandType.StoredProcedure
With command.Parameters
.Add(New SqlParameter("@Ridfrom", SqlDbType.NVarChar))
.Add(New SqlParameter("@PidTo", SqlDbType.Money)).Direction = ParameterDirection.Output
.Add(New SqlParameter("Returnvalue", SqlDbType.Int)).Direction = ParameterDirection.ReturnValue
End With
End Sub
this is my stored procedure
eg:If i pass @RidFrom=1 im getting Output value @pidTo=3
ALTER PROCEDURE usp_Procedure
@Ridfrom nVarChar(50),
@PidTo nVarchar(20) output
AS
SELECT @PidTo = ProcDetails.Procedure_ID
FROM ReportMaster INNER JOIN
ProcDetails ON ReportMaster.Procedure_ID = ProcDetails.Procedure_ID
WHERE ReportMaster.Report_ID = @Ridfrom
RETURN
|
|
|
|
|
Sabui wrote: can u susggest a way to solve the error
What error? You don't mention getting any errors.
@PidTo does not need to be an output parameter, the value of ProcDetails.Procedure_ID will be returned from the select statement.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Dear Mark,
thank you for your suggestion.
I tried in that way i was successful to ruen value from the SP.
but now the problem is im not able to pass and retrieve value to and from this SP.
@Ridfrom and return value is not changing.
please help me
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
Dim SQLEV As SqlClient.SqlConnection = New SqlClient.SqlConnection
SQLEV.ConnectionString = "Persist Security Info=False;Integrated Security=SSPI;database=db_chart;server=nrppc-mis1\sqlexpress"
Dim combo As String
combo = ComboBox1.SelectedValue.ToString
MsgBox(combo)
Dim command As New SqlCommand("usp_Procedure", SQLEV)
Dim adapter As New SqlDataAdapter(command)
command.CommandType = CommandType.StoredProcedure
'command.Parameters("@Ridfrom").Value = combo
With command.Parameters
.Add(New SqlParameter("@Ridfrom", SqlDbType.NVarChar))
.Add(New SqlParameter("Returnvalue", SqlDbType.Int)).Direction = ParameterDirection.ReturnValue
MsgBox(command.Parameters("@Ridfrom").Value)
MsgBox(command.Parameters("Returnvalue").Value)
End With
|
|
|
|
|
Are you expecting the values to be displayed in the messageboxes? Of course nothing has changed, you have not caused the command to execute yet.
Please read a book or article on ADO.NET before trying to work with it, you don't seeme to understand how it fuctions.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
hello,
I think you forgot to post the error or
problem you are facing...
Post the error or problem that you are facing,
so that it is easier to solve it.
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
I installed some .net application on my machine ( lets say this is some exe ).
I double click on the file - and now there are two options
A. the exe file is ran once before this double click - and that mean that the IL code is compiled and the native code is exists => in this case the exe.
B. the exe file is running for the first time - and the IL is not compiled yet by the JIT compiler ==> that mean that now the IL code will compile and the native code will be stored at some place.
My question are
1. How the .net framework know if the code was compiled already ?
Is there some flag or some sign that can tell if the native code compiled already ?
2. Where the native code will be stored ?
Thanks for the help.
|
|
|
|
|
I think this might help you ^
|
|
|
|
|
The native code is not kept around beyond the execution of a process. Whenever the EXE starts it will gradually JIT-compile whatever classes/methods need executing.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
These two links may help you to figure things out.
Straight from the horses mouth[^]. Slightly dated (uses VS2003) but I believe that it is still largely accurate.
JIT Compilation and Performance[^]
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
Why do programmers often confuse Halloween and Christmas?
Because 31 Oct = 25 Dec.
|
|
|
|
|
Unless you use ngen.exe, your executable will be compiled everytime you run it.
|
|
|
|
|
Hi,
I have a client server architecture, may have 1000+ clients (windows application/winforms) communicate with the hosted server to process some information!
There may have 3 to 4 methods/function to be processed on the server.
Both client and server can be developed in any of the .net technology like we have .net remoting, asp.net web service or WCF Service!
If you can advice which one will be feasible of this requirement.
Like in performance point + load on the server for the request/response time. I am not much worried about the security (its intranet/vpn).
Thanks in advance!
Waiting for the response!
Divyesh
|
|
|
|
|
You can use WCF for the services which the clients will be consuming. It will allow you to communicate with any client (not just .Net) through a lot of means like http/namepipes/tcp etc.
Plus, it being a newer technology, you don't have to worry about an upgrade at least for few years.
|
|
|
|
|
There are two aspects that you need to consider while you choosing among
.NET Remoting Service, Web Service and WCF Service.
1. Portability
-> If you are using .NET Remoting Service then both client and server should be in same
technology (e.g. .NET in this case)
-> While if you consider Web Service or WCF service you can also access it from linux machine
or any other OS based machine (as client).
2. From request/response time point of view or performance point of view .NET remoting service
is always best compared to web service and wcf service.
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
divyesh1432 wrote: WCF Service
This is the latest so should be an easy pick.
However, WCF service provides many different types of bindings and picking the best binding for your application will not be easy.
My signature "sucks" today
|
|
|
|
|
Abhinav S wrote: picking the best binding for your application will not be easy
The kind of client you are communicating to would help.
|
|
|
|
|
Hey guys,
I wonder whether anybody can help me out in this problem. I use wcf to get data. After I got the data, I cache them using Enterprise library Cache block. I am trying to incorporate the sqlDependency cache- notification model to invalid my cache.
Anyone have better idea to solve this problem or setup the SqlDependency expiration across wcf end points?
Thanks,
Sen
|
|
|
|
|
I have a piece of hardware with some buttons which when pressed will send an events via a USB interface to an application I have written(let's call it APP1).
I have a 2nd application (let's call it APP2) that reacts to certain keystrokes (for example when it sees a Key Press event for SPACE BAR it will pop-up a dialog). I have no control over the code in this application.
I need to make it so when APP1 sees a button is pressed on the hardware it will send a keystroke to APP2 (or to all windows).
Some constraints:
- I cannot change the hardware to simply send the SPACE BAR, I only have control over APP1.
- There may exist another version of APP2 that will react to a different button such as ENTER key (or any key sequence for that matter) so I would like to have APP1 be configurable in the event it sends to other windows/applications and is in no way dependent on the name of APP2 as I may see many versions of APP2.
What is the best way to handle this? Sendkeys?
What information do I need to know about APP2 from within APP1 to send the keystroke to this window specifically? I'm OK with (and would prefer) sending this event to all Windows if that is possible so if APP2 changes in the future APP1 is not impacted.
I'm fairly new to Windows Programming so all help and insight is appreciated.
Thanks in advance.
KG
|
|
|
|
|
Hi,
you should not send anything to "all windows" or "all applications". A lot of applications and windows are meant for human interaction only, and may suddenly display a dialog, where some of not all keys get interpreted the same as clicking the OK button. You cannot possibly want that.
you should send a keystroke or a sequence of keystrokes to a single window, after making sure you got the right window; and even that is not always fool proof, as it may change soon after you've checked.
There are a couple of ways to do it:
- System.Windows.Forms.SendKeys.SendWait() sends keys to the active app and window;
- SendMessage() could be used to send regular Windows messages such as WM_KEYDOWN and WM_KEYUP.
The former is managed but unsafe as, even when you get the ForeGroundWindow's title text and check it, the active window may change suddenly; the latter is a bit harder to use but should always be OK. I use both, and choose depending on circumstances.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Find a way to have App2 tell App1 that it wants these events.
|
|
|
|
|
Take a look at these articles here and here.
Life is a stage and we are all actors!
modified on Thursday, June 3, 2010 5:22 PM
|
|
|
|
|
APP2 was not to be changed.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
I didn't understand the question completely, I've thought that it's about top level windows, which is wrong.Unfortunately SendKeys works only with active application so maybe enumerating all top level windows and their child controls is required so I would strike my previous post.
Life is a stage and we are all actors!
|
|
|
|
|
Enumerate all processes
See if the process has a UI(to distinguish from other background processes)
The code will be like
For Each x As Process In Process.GetProcesses
If x.MainWindowTitle <> "" And x.MainWindowTitle <> Me.Text Then
AppActivate(x.Id) 'If you know the application's title, AppActivate("Title") will also work
SendKeys.SendWait("KEYS YOU WANT TO SEND")
End If
Next
AppActivate(Me.Text)
|
|
|
|
|