|
Hi guys,
I wanted to know how do we access a specific exe's instance from class library dll or any application.
The description of problem domain is as follows :
I have one VB.NET exe application which has certain functionality in it in classes. There are several instances of the same exe running in memory. I want to access specific instance and create instance of class in the exe from another client application.
Could you suggest a way to do it...
Thanks & Regards,
Birendra
Birendra
|
|
|
|
|
Input string was not in a correct format.
Line 94 seems to be the culprit but I don't know why
Description: An unhandled exception occurred during the execution of the current web request.
Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.FormatException: Input string was not in a correct format.
Source Error:
Line 92: SqlConnection1.Open()
Line 93: Dim dreader As SqlClient.SqlDataReader
***********************************************************************
***********************************************************************
Line 94: dreader = cmdCategoriesById.ExecuteReader(CommandBehavior.SingleRow)
**********************************************************************************
**********************************************************************************
Line 95: If dreader.Read() Then
Line 96: txtCategoryName.Text = dreader(1)
Source File: c:\inetpub\wwwroot\VBNetUnleashed\WebApplication3\WebForm1.aspx.vb Line: 94
Stack Trace:
[FormatException: Input string was not in a correct format.]
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
WebApplication3.WebForm1.ddlCategoryID_SelectedIndexChanged(Object sender,
EventArgs e) in c:\inetpub\wwwroot\VBNetUnleashed\WebApplication3\WebForm1.aspx.vb:94
System.Web.UI.WebControls.ListControl.OnSelectedIndexChanged(EventArgs e)
System.Web.UI.WebControls.DropDownList.System.Web.UI.IPostBackDataHandler.RaisePostDataChangedEvent()
System.Web.UI.Page.RaiseChangedEvents()
System.Web.UI.Page.ProcessRequestMain()
Here is my code:
Private Sub ddlCategoryID_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles ddlCategoryID.SelectedIndexChanged
Dim categoryid As String
categoryid = ddlCategoryID.SelectedItem.Text
cmdCategoriesById.Parameters("@categoryid").Value = categoryid
SqlConnection1.Open()
Dim dreader As SqlClient.SqlDataReader
dreader = cmdCategoriesById.ExecuteReader(CommandBehavior.SingleRow)
If dreader.Read() Then
txtCategoryName.Text = dreader(1)
txtCategoryDescription.Text = dreader(2)
End If
dreader.Close()
SqlConnection1.Close()
End Sub
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles btnSave.Click
With cmdCategoriesUpdate
.Parameters("@categoryid").Value = ddlCategoryID.SelectedItem.Text
.Parameters("@categoryname").Value = txtCategoryName.Text
.Parameters("@categorydescription").Value = txtCategoryDescription.Text
End With
SqlConnection1.Open()
cmdCategoriesUpdate.ExecuteNonQuery()
SqlConnection1.Close()
End Sub
End Class
|
|
|
|
|
The category id could not be converted to a number.
You should convert the values to the correct data type before putting them in the parameters. Also, you should specify the data type of the parameters, or the command object has to ask the database for the data types. This causes an extra round trip to the database.
---
b { font-weight: normal; }
|
|
|
|
|
I am lost, still not sure what values I need to correct to the right data type?
|
|
|
|
|
You have to make sure that the category id value can be converted to a number. If there is a possibility that it's not a number, use Double.TryParse to parse the string.
---
b { font-weight: normal; }
|
|
|
|
|
Where do I use that double.tryparse?
Where is that put in the code
|
|
|
|
|
Now you are getting the string from the form field, then putting the string into the parameter. After you have gotten the string, try to parse it. If the parsing was successfull, you can continue by converting the double to an int (as I assume that is the datatype in the database) and put it in the parameter.
If the parsing fails, you can either set the value to a default value, or display an error message.
---
b { font-weight: normal; }
|
|
|
|
|
hi all
i had made the database project in vb.net and access. now i want that my
software should generate the reports how to do that any software required for
the report generation. or what i want is take the data from data base and generat report.
ddd
|
|
|
|
|
Hi,
You can use Crystal Report for this.
Or if you dont have any Crystal Report software then. Open a dataset in vb.net and fill it up with the required data after giving search parameter. Now create programatically a text file(.txt) and write the out put from the query into that text file. that will solve your problem of reporting
DD
Debasish Das(MBA), is a hardcore software solution provider, working in ESSPL (INDIA). Got 5 years of experience on various client server technologies like Visual Basic,.NET framework, Power Builder, Message Queue Server. And also posses sound knowledge in Quality Processes applied to software engineering. Quite often travels overseas to provide solutions to some fortune 100 clients.
He can be reached with mr_debasishdas@hotmail.com or debasishd@esspl.com
|
|
|
|
|
I'm sorry, again, for this noobs question.
I'm using Visual Stuido 2005 and I was trying to insert a data to database.
This is how I do it so far.
1. Set the dataset ( Ms. Access database ), which results are PlasmaDBDataSet and UserTableAdapter
2. From PlasmaDBDataSet, I drag UserID field to my windows form, resulting UserIDTextBox and UserBindingNavigator, and codes :
<br />
Public Class MasterUserForm<br />
<br />
Private Sub UserBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UserBindingNavigatorSaveItem.Click<br />
<br />
Me.Validate()<br />
Me.UserBindingSource.EndEdit()<br />
Me.UserTableAdapter.Update(Me.PlasmaDBDataSet.User)<br />
<br />
End Sub<br />
<br />
Private Sub MasterUserForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
'TODO: This line of code loads data into the 'PlasmaDBDataSet.User' table. You can move, or remove it, as needed.<br />
Me.UserTableAdapter.Fill(Me.PlasmaDBDataSet.User)<br />
<br />
End Sub<br />
End Class
When running the program, I already can add new records and also navigate through all the records. The problem is the records werent save to my access database. I've try to add Me.PlasmaDBDataset.AcceptChanges() but still dont work.
I do search the MSDN but it say nothing more or less, just like that. Please kindly help me with this.
Thank you
WiL
|
|
|
|
|
A dataset is a disconnected view of the databaswe. Once you've made changes, you need to, seperately, connect back to your database and pass them through. There is at least one excellent article on doing this with access in C# on codeproject, I recommend searching the site.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
When adding a access dataset, I were prompted "Would you like to copy the file to your project directory and bla bla".
And even if my access file already in my project directory, I still get prompted to copy the file.
Here's the strange thing. If I klik "Yes" then the problem I like stated before will occured. New records aren't saved to database. But if I klik "No", there's no problem at all. Records are saved correctly. Same access file and same code.
I've read the MSDN again and to parse data from dataset to database we can use "Update " method of TableAdapter or DataAdapter.
Finally I can move foward with my .Net.
Thank CG. Looking foward for your help again next time.
WiL
|
|
|
|
|
i want to work with screen servers.
what is the name of the DLL should i work with ?
is it User32.dll?
and what's the name of the functions that should i use?
Militiaware
Faris Madi
|
|
|
|
|
To start the screensaver, take a look at this[^].
If you want to write a screen saver, take a look at this[^].
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
i created a DLL file - class lib.
how to lock the code and prevent the others to get my code.
Militiaware
Faris Madi
|
|
|
|
|
Write it again in C++. Sorry, I assume you used VB.NET, to have asked this, and that's your only option.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Like Christian said, if you want to protect the code, don't write it in any of the Managed languages, like VB.NET, C#, ...
You can make it more difficult to understand if you used an Obfuscator (one comes with Visual Studio.NET), but even the best obfuscator won't guarantee that the code can't be reverse engineered.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave Kreskowiak wrote: but even the best obfuscator won't guarantee that the code can't be reverse engineered.
Neither will writing it in C++
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
My Blog[^]
|
|
|
|
|
I kind of left that point out, didn't I?
But, it does make it more difficult than just opening Reflector and clicking on a method to decompile it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
okay...what about securing my control that i made.
i mean i created a control and give it to some one and i want to use it only not to get my code.
Militiaware
Faris Madi
|
|
|
|
|
Welcome to the dilema that every developer faces!
There is no answer for this.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am having real difficulty in opening a specific .XLS file from within Access.
I want to call my Excel file from Access to work with charts (templates) and then tweek the values of the charts based upon data from Access tables.
I used the Wizard to create the general subroutine and then tried to tailor it to open up my specific file - what I have below has SERIOUS problems when switch between worksheets in the .XLS file and the cursor opens as Hour-Glass until moved out of grid/cell area.
Any help on how to do this, where to look?
Thanks,
Johnny
Here is my code from Access VBA code:
Private Sub cmdRunExcel_Click()
On Error GoTo Err_cmdRunExcel_Click
Dim oApp As Object
Dim xlApp As Object
<br> <br>
Set oApp = CreateObject("Excel.Application")
Set xlApp = GetObject("C:\work\myDB_Charts.xls")
oApp.Visible = True
xlApp.Application.Visible = True
xlApp.Parent.Windows(1).Visible = True
<br> <br>
'Only XL 97 supports UserControl Property
On Error Resume Next
oApp.UserControl = True
<br> <br>
Exit_cmdRunExcel_Click:
Exit Sub
<br> <br>
Err_cmdRunExcel_Click:
MsgBox Err.Description
Resume Exit_cmdRunExcel_Click
<br> <br>
End Sub
|
|
|
|
|
I have been having trouble with Excel myself so I don't know if I can be of any help to you. My suggestion would be to try recording a macro of what you want to do. Copy and paste the code it generates into your subs and then tweak it to suit your needs. That got my program "close" to working but finding answers for Excel seems to be very difficult.
Hope this helps, Garner
|
|
|
|
|
Thanks for the suggestion - I didn't think about recording a macro.
I was able to get a working solution that is adequate for my needs. I basically followed the example that I found in the Object Browser's help for "GetObject" (in VBA library)
It seems cumbersome to have to use the 2 API functions (to find a window handle to Excel and then "post" it to the Object table via a windows message), but in the end it works.
I will now need to control operation in Excel (worksheet) from within Access and VBA. Ultimately, I will use a chart in my Excel file as a template, changing the values according to latest data in Access.
Best regards,
Johnny
|
|
|
|
|
Johnny,
Since you seem to know how to use VB & Excel together, is there any chance that you would have time to look at my Jan. 6th Post, "VB/Excel interaction"? I have tried everything that I can think of and I still can't make it work. Nobody else has answered.
Thanks in advance, Garner
|
|
|
|