|
Repeating your question isn't going to change the answer.
Like I said you'll have to store the username in a variable that can be accessed by the second form.
Then in the submit click event you'll have to use a INSERT sql statement to insert the correct data into the second table (provided that the username is present in the first table)
On a side note you might want to take Dave's advice and change your key to a numeric key (auto increment).
Don't expect us to write this for you.
This is very basic and we are happy to help where needed but you need to program it. If you get stuck on a particular part you can then come back here and ask a more specific question, because the way your asking it now is asking us to write your whole program. If you want that go to rentacoder.com.
|
|
|
|
|
i have done my coding part
the datas from my second form is stored well in the table
i have used a variable as u said and have used that variable in my insert query but the data is not been retrieved
anyways thanks for replying and helping
|
|
|
|
|
Well that's different then.
Do you get an error? If so post it here.
What do you mean with
vijay2482 wrote: the data is not been retrieved
Are you trying to retrieve the data from the DB after you inserted it (if so you'll have to do a SELECT after it ).
Or do you mean that your variable is empty?
If so:
Try passing the username to the second form in the constructor of the second form and setting a local variable on the second form.
Accessing a variable on the first form from the second form will only work if that variable is declared as 'shared' or if you have a reference to the first form on your second, but since you probably close the first form there is no such reference.
|
|
|
|
|
i dont get any error msg
im trying to store a value from the first for in the database
|
|
|
|
|
vijay2482 wrote: im trying to store a value from the first for in the database
When? Upon clicking the submit?
If so:
You need to pass the variable to the second form when you open the second form:
dim frm as form2(variable)
Then in the second form:
private sUsername as string
public sub new(variable as string)
initializecomponent
susername = variable
end sub
Now you can use that variable (susername) in the submit button
Without more explanation(and perhaps a bit off your code) I can't give more info than that.
|
|
|
|
|
iam trying it out will get to you back if i find some problem
thanks
|
|
|
|
|
i have sorted out the problem
thanks a lot
modified on Wednesday, February 4, 2009 6:10 AM
|
|
|
|
|
Dear use Update Query inplace of Insert
As i understand if UserName feild is primary key so in whole table we will found only one entry for that userName so use Update Query with WHERE Condition
Update tblName Set f1 = v1 ,f2= v2... WHERE UserName = "UserName"
|
|
|
|
|
Please Tell me about the Full Text Query!
Why and How we use the Full Text Query....
as soon as possible........
Thanx!!!!!!!!!!!!!!!!
|
|
|
|
|
Class starts at 8.30. Make sure you're on time and bring pen and paper to make notes
I are troll
|
|
|
|
|
All you had to do to find this out is use any search engine. Here, let me show you[^].
|
|
|
|
|
He can't google he is doing his exam and the teachers blocked it but forgot to block CP
|
|
|
|
|
Someone is failing the midterm..
|
|
|
|
|
As I am Using a USB HID Barcode Scanner , I am in need of stop reading the barcode Immediately after the barcode scan and it should be able to start the scanning only after clicking a button
Is ther any simple way for this? Request ur kind help.
Noufi
Thanx.
|
|
|
|
|
No, there isn't. Since the bardcode scanner is impersonating a keyboard, you're getting keystrokes inside your application. Treat them as such.
|
|
|
|
|
Or can we block reading the USB using VB.Net Code
|
|
|
|
|
Yeah, right. Block reading the USB port system-wide? I've got two words for you: Shared System. The app has to share the system with all other apps that may be running at the time. What if those apps need access to USB devices too?? Also, how is the code going to tell the difference between a USB-based keyboard-wedge barcode scanner and a normal USB keyboard.
Lousy idea.
|
|
|
|
|
I have a very simple Windows form in C# with one pictureBox and two textBoxes. When the form loads I want the focus to go to textBox1. I have set the TabStop property to True and the TabIndex to 0, but it didn't work. I have tried:
textBox1.Focus();
and
textBox1.Select();
in both the Form_Load and Form_Activated event handlers, but these have not worked. If I use either of these methods in the pictureBox_Click event handler they work fine!
Can anybody help please?
|
|
|
|
|
Sorry, I posted this on the wrong forum. I have now posted it on the C# forum, so please ignore this one
|
|
|
|
|
How to store DateTimePicker value from a form to an MS Access Database?
|
|
|
|
|
There are two method for store value in database
first one is execute following query
str="insert into tableName(dateFieldName) values(#" & datatimepicker1.Value & "#)"
second one is use parameterized query as following
Dim QueryText As String<br />
Dim QueryValue As String<br />
QueryText = "INSERT INTO tableName(dateFieldName)"<br />
QueryValue = "Values(@dateValue)<br />
Dim com As System.Data.OleDb.OleDbCommand = New System.Data.OleDb.OleDbCommand<br />
com.Parameters.Add("@dateValue", OleDb.OleDbType.Date, 16).Value = datatimepicker1.Value 'here you can use length as you wish<br />
com .CommandText = QueryText & QueryValue<br />
com .ExecuteNonQuery()
in above two method i assume you can manage connection object. If have any problem, then let me know
|
|
|
|
|
its working
thanks a lot
modified on Tuesday, February 3, 2009 5:18 AM
|
|
|
|
|
Hi,
I have a collection of Structures and I need to modify these structures. Am I able to do this without first removing the structure from the collection, making the modifications and then reinserting back into the collection?
I have tried using:
Ctype(Collection.Item("Item"), StructureName).Property = Value
but I get a compile error saying that 'Expression is a value and therefore cannot be the target of an assignment'
I have also tried
Collection.Item("Item").Property = Value
but get a RTE saying that 'Late-bound assignment to a field of a value type 'Group' is not valid when 'Group' is the result of a late-bound expression' (Group is the nam,e of my structure, BTW).
I have modified objects in a collection using the Ctype method but am unable to do it with structures so currently am removing from the collection first. Any advice is appreciated. Thanks
|
|
|
|
|
Have you tried changing the structure to a Class? I have this feeling that as Structures are value types, not reference types, this isn't allowed.
Also, have you considered using something like List(Of T) to hold the items instead (assuming that's possible, of cause)? It will save you casting the values when you want to use them or using Late Binding? Also, it'll mean you won't be able to accidently add the wrong sort of item to the list, which would cause InvalidCastException with code like this. Of cause, if you've considered this, feel free to completly ignore me
|
|
|
|
|
Thanks for your reply.
I didn't want to classes because it seemed to be overkill considering my structures only contain 3 maybe 4 properties. So I thought structures would be more appropriate.
But no, I haven't considered using List(Of T). I'm fairly new to software development and am still finding my feet with VB.NET so was unaware of List(Of T). Thanks for the suggestion, I will give it a try and let you know the outcome
|
|
|
|