|
Good Morning All
Dave thanks for everything, am happy without a Wizard, i will never use a wizard again, and things are easier without it.i would like
UPDATE Clients SET Client_Name = @Client_Name, Contact_Person = @Contact_Person, Purchase_Date = @Purchase_Date, Client_Address = @Client_Address, Client_Telephone = @Client_Telephone, Client_Cell_No = @Client_Cell_No, SerialNummber = @SerialNummber, Product_Status = @Product_Status, Client_Email = @Client_Email
WHERE (Client_ID = @Original_Client_ID)
AND (Client_Address = @Original_Client_Address OR @Original_Client_Address IS NULL AND Client_Address IS NULL) AND (Client_Cell_No = @Original_Client_Cell_No OR @Original_Client_Cell_No IS NULL AND Client_Cell_No IS NULL) AND (Client_Email = @Original_Client_Email OR @Original_Client_Email IS NULL AND Client_Email IS NULL) AND (Client_Name = @Original_Client_Name OR @Original_Client_Name IS NULL AND Client_Name IS NULL) AND (Client_Telephone = @Original_Client_Telephone OR @Original_Client_Telephone IS NULL AND Client_Telephone IS NULL) AND (Contact_Person = @Original_Contact_Person OR @Original_Contact_Person IS NULL AND Contact_Person IS NULL) AND (Product_Status = @Original_Product_Status OR @Original_Product_Status IS NULL AND Product_Status IS NULL) AND (Purchase_Date = @Original_Purchase_Date) AND (SerialNummber = @Original_SerialNummber OR @Original_SerialNummber IS NULL AND SerialNummber IS NULL)
; SELECT Client_Name, Client_ID, Contact_Person, Purchase_Date, Client_Address, Client_Telephone, Client_Cell_No, SerialNummber, Product_Status, Client_Email FROM Clients
WHERE (Client_ID = @Client_ID)
I would like to be sure if am understanding this update statement very well. This SQl statement updates the Clients table on the above mentioned fields, for example the variable @Client_Name needs to be declared like this
cmd.Parameters.Add("@Client_Name", SqlDbType.VarChar, 50)
Am I right?
Ok lets Continue I understand the first 5 lines ,and I would like you to confirm with me for line 6.
WHERE (Client_ID = @Original_Client_ID)
Here we are making sure that a correct record gets affected by update. Client_ID is the Primary key of the table Clients. I want to understand the @Original_Client_ID, it’s the Original value before update happens ? please Explain for me that part and why is it needed.
Next here is another part that will help me understand the whole thing. The Following line after the where “And” was used.
AND (Client_Address = @Original_Client_Address OR @Original_Client_Address IS NULL AND Client_Address IS NULL)
Please Explain for me the above statement, exclude the one I asked for @original
And the last one is
; SELECT Client_Name, Client_ID, Contact_Person, Purchase_Date, Client_Address, Client_Telephone, Client_Cell_No, SerialNummber, Product_Status, Client_Email FROM Clients
WHERE (Client_ID = @Client_ID)
Why a “;” and a new select statement here, I suppose it separate the update statement and this only verifies the update?
Thanks for your help
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
First, when you post something in <pre> tags, make sure the text doesn't extend beyond the right edge of the screen. Go through and put in CR's at the points where text should wrap to the next line. It makes read your posts, an answering them much easier. Hit the Preview button to see what you're post is going to look like to us before you hit the Post Message button.
Vuyiswa wrote: for example the variable @Client_Name needs to be declared like this
cmd.Parameters.Add("@Client_Name", SqlDbType.VarChar, 50)
Am I right?
Partially. The length and type of the field you specify is determined by the length and type of the field in the table definition.
Vuyiswa wrote: WHERE (Client_ID = @Original_Client_ID)
... I want to understand the @Original_Client_ID, it’s the Original value before update happens ?
<blockquote class="FQ"><div class="FQA">Vuyiswa wrote:</div>The Following line after the where “And” was used.
AND (Client_Address = @Original_Client_Address OR @Original_Client_Address IS NULL AND Client_Address IS NULL)
Please Explain for me the above statement, exclude the one I asked for @original</blockquote>
Yep. All of these "Original value" parameters is to make sure that someone else didn't change the record while you were looking at it. If someone else changed the record between the time you fetched it, made changes to it, and the tried to write it back, a Concurrency Violation will occur. The SQL statement will return something like "0 rows affected" when your code was expecting 1 row. If it doesn't get back "1 row affected", then code knows that something in the record changed and you should give the user some kind of option to tell it what to do with the new changes since the changes someone else just made would normall be overwritten if you just specified the record ID alone in the WHERE clause.
Vuyiswa wrote: Why a “;” and a new select statement here, I suppose it separate the update statement and this only verifies the update?
It is seperate the UPDATE from the SELECT statement. The SELECT statement is there to return the new record back to the caller, not only to give the code the chance to verify the change was made, but to update the callers DataSet or DataTable.
|
|
|
|
|
Thanks Dave
i got it
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
hai all,
I need to know, is csv file format accept image.
if it is yes tell how can we do that in our vb.net form????
Thanks in Advance
Senthil.S
Senthil S
Software Engineer
|
|
|
|
|
CSV file does not accept images.
|
|
|
|
|
CSV means "Comma Seperated Values". It's a text file, which you can esaily open in Notepad to view. It may be possible to do, but your application is the only one that's going to be able to read it. Noone puts images into a text file because it's a very inefficient way to represent the data that makes up an image.
|
|
|
|
|
I created a collection for a combo box in the designer, but I need to assign numeric values to the collection so that I can compare them to the database for use in an Update statement.
How can I do this?
Should I create an array and assign the array to the collection instead?
Will using an array slow the program down?
|
|
|
|
|
AAGTHosting wrote: I created a collection for a combo box in the designer,
OK. Where is the data comming from that populates this "collection"?? Or are you talking about a DataSet instead?? If the data is comming from a database, then you have to return not only the item descriptions from your table, but also the primary key field for those items. Your table might be something like:
Id Description
--- ----------------
0 Blue
1 Black
2 Red
3 Green
You need to return both columns so that you can tell the ComboBox's DisplayMember property to show the Description field and it's ValueMember to point to the Id field. When the user picks one of the colors from the ComboBox, it'll return the ValueMember instead (the Id of the Description, not the Description itself).
AAGTHosting wrote: Should I create an array and assign the array to the collection instead?
Nope. Completely pointless and duplicates effort and possible data, depending on how you do it.
AAGTHosting wrote: Will using an array slow the program down?
No. But needlessly dupicating data will.
|
|
|
|
|
I was going to store the data for the collection in the designer itself, although I do have a database table that holds the days of the week as well. Maybe I should populate the cobmo box from the database. All I need to do is update the database with changes in the sechdule from and to times in the database.
|
|
|
|
|
AAGTHosting wrote: I was going to store the data for the collection in the designer itself
Since the designer only generates code from a visual representation of an idea, you can't store data in the designer.
AAGTHosting wrote: Maybe I should populate the cobmo box from the database. All I need to do is update the database with changes in the sechdule from and to times in the database.
If the data populating the ComboBox is directly related to data in the database, yes, this would be the best idea.
|
|
|
|
|
I'm new to application, I would like to read a step-by-step article teaching me how to create a role-base win-application (using defined users and passwords, not windows's).
thanks
Shimi
|
|
|
|
|
There's a bunch of different ways of doing this. You can start by reading these[^].
But, if you're new to programming, let alone any experience with the .NET Framework, something like this could be way over your head.
|
|
|
|
|
thanks for your post,
I want to develop an application for many users and keep their information in a SQL server table, I just don't know how you make the entire application respond when a user has been switched.
Shimi
|
|
|
|
|
You'll probably need a User object you create that keeps track of the user roles. All of you application code will have to keep referring back this object to check if the user has the appropriate permissions to run code and setup the user interface appropriately.
Here's[^] a another view of the subject.
You're looking for a simple answer to a very large and complex problem. There is no single step-by-step guide that's going to show you how to do this, let alone explain how and why it works. The solutions involve knowing about various design patterns and how they interact with each other. This topic alone can fill over a 1000 pages.
|
|
|
|
|
|
I am working on a database application by using VB.Net and a COM Addin to integrate my application with Outlook 2003.
- I am calling an 'Outlook New Message window' from a VB.Net form.
- On Email ItemSend event I am updating the database by using a COM Addin.
- When I get focus back to my VB.Net application, I want to refresh current form with updated data.
Can anyone guide me how to call a function of application A from application B which refresh/reload a form in application A without restarting the application.
I have tried System.Diagnostics.Process but it doesn't seem working.
I would appreciate a quick response.
Nas
|
|
|
|
|
manisghouri wrote: When I get focus back to my VB.Net application, I want to refresh current form with updated data.
If I understand the problem correctly, all you have to do is the same thing that you did before to get the data you're already showing. DOing it again will perform the same query, updating what you got from the database with the changes you just made.
Your description isn't very clear about what you're doing, what form is showing what data, where that data is comming from, what the business process is, ...
|
|
|
|
|
Thanks for your reply. Let me be more specific to my problem.
I am working on a Customer management system which comprises of two applications.
Application 1 (customer management) is a windows application and based on VB.net and SQL Server 2000.
Application 2 is a COM Addin for Outlook 2003 and written in VB.net
-When an user select/open a customer form (in App 1), I display customer information on the form inlcuding recent emails summary in a grid.
-When user select an option 'New Email', I call Outlook New message window from App 1. On ItemSent event in Outlook I am saving email data ( email address, date, subject, email body and attachments) in customer database By using a COM Addin (This is done in App 2).
-As soon as email is sent and email message has been saved in database, application 2 terminates itself and Application 1 gets focus on currenltly loaded customer form. At this time I want to show recently sent email data on the form in email summary grid.
I hope it will give you a better understanding about my problem.
I will appreciate your support.
Nas
|
|
|
|
|
manisghouri wrote: When an user select/open a customer form (in App 1), I display customer information on the form inlcuding recent emails summary in a grid.
Repeat this step after the COM object is closed.
Now detecting when the COM object closes may be the real issue, hopefully dave will help there!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
You're going to have to implements some remote call to tell App A to refresh itself. You can do this either using .NET Remoting (deprecated after .NET 2.0) or Windows Communication Foundation (.NET 3.0 and above).
|
|
|
|
|
Not sure if I'm heading in the right direction but I have an application that when minimized it goes into the system tray, but then when the user double clicks the the application icon a second time it opens another instance of the application I would like it to activate the instance already running in the system tray. I can use Process.GetProcesses() to find if the process is currently running, but not sure what comes next I will list below what I have got so far... This application requires the user to login so I use a sub main to login then run app and when not used it is minimized don't want users logging in multiple instance...
Any help would be Greatly Appreciated
VB.net VS2005
---------------------------
Public Sub Main()
Dim localAll As Process() = Process.GetProcesses()
Dim x As Integer
For x = 0 To localAll.Length - 1
If InStr(localAll(x).ToString, "MyApp") Then
'Activate the running app ' <-- Need Help Here
Else
Dim dlg As New LoginForm1
If dlg.ShowDialog() = DialogResult.OK Then
Application.Run(Form1)
End If
End If
Next
End Sub
dotnetme2
|
|
|
|
|
For a single instance app, all you have to do is Enable the Application Framework in your "My Project" item in the Solution Explorer.
What do you mean by "Activate"?? Are you trying to show the main form of your app?? EXACTLY how is this form hidden from the user??
|
|
|
|
|
What I mean by activate is basically maximize the application in the system tray rather then start a new instance...
Thanks for the tip But.... if I check the "Enabled application framework" check box in "My Project" it says that I must use a "Form" as my "Startup object" and I have "Sub Main" in Module as my startup so I had to uncheck it. I'm sure there is another way to launch "sub main" but I not sure just how to do it...
Is there another to either make it a single instance??? The reason I used a module was instead of a form was so I can call the login form have the user login then close the login form and launch the main form of the app.
Thanks for any help...
dotnetme2
|
|
|
|
|
dotnetme2 wrote: Is there another to either make it a single instance???
It's been discussed and rehashed countless times for years. All you have to do is Google for "VB.NET single instance application". Here's[^] a good one, since it even has the "show main window" functionality you were looking for.
|
|
|
|
|
Perfect Thanks...
dotnetme2
|
|
|
|
|