473,405 Members | 2,445 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Join

OuTCasT
374 256MB
hi all

i have got a win app that has 2 screens
SalaryScreen and EmployeeScreen



now i bind the data to a dataTable manually in the code like this.

Expand|Select|Wrap|Line Numbers
  1. Try
  2.             sqlConnection = New SqlConnection("Data Source=DONOVANPC\SQLEXPRESS;Initial Catalog=DemoDB;Integrated Security=True;Pooling=False")
  3.             sqlConnection.Open()
  4.             sqlcommand = New SqlCommand("USE " + My.Settings.sqlDataBaseName + vbCrLf & _
  5.                                         "SELECT * FROM EmployeeDetails", sqlConnection)
  6.             sqlAdapter = New SqlDataAdapter
  7.             sqlAdapter.SelectCommand = sqlcommand
  8.             sqlDataTable = New DataTable
  9.             sqlAdapter.Fill(sqlDataTable)
  10.  
  11.             ' Bind Controls with datatable
  12.             txtEmployeeCode.DataBindings.Add("text", sqlDataTable, "EmployeeCode", True)
  13.             txtSurname.DataBindings.Add("text", sqlDataTable, "EmployeeSurname", True)
  14.             txtInitials.DataBindings.Add("Text", sqlDataTable, "EmployeeInitials", True)
  15.             txtFirstNames.DataBindings.Add("text", sqlDataTable, "EmployeeFirstName", True)
  16.             cbTitle.DataBindings.Add("Text", sqlDataTable, "EmployeeTitle", True)
  17.             txtNickName.DataBindings.Add("text", sqlDataTable, "EmployeeNickName", True)
  18.             txtPhysAddress1.DataBindings.Add("text", sqlDataTable, "EmployeePhysicalAddress1", True)
  19.             txtPhysAddress2.DataBindings.Add("text", sqlDataTable, "EmployeePhysicalAddress2", True)
  20.             txtPhysAddress3.DataBindings.Add("text", sqlDataTable, "EmployeePhysicalAddress3", True)
  21.             txtPhysPCode.DataBindings.Add("text", sqlDataTable, "EmployeePhysicalPostalCode", True)
  22.             cbGroup.DataBindings.Add("text", sqlDataTable, "EmployeeGroup", True)
  23.             cbGender.DataBindings.Add("text", sqlDataTable, "EmployeeGender", True)
  24.             cbLanguage.DataBindings.Add("text", sqlDataTable, "EmployeeLanguage", True)
  25.             cbMaritalStatus.DataBindings.Add("text", sqlDataTable, "EmployeeMaritalStatus", True)
  26.             txtTelHome.DataBindings.Add("text", sqlDataTable, "EmployeeTelHome", True)
  27.             txtCellNo.DataBindings.Add("text", sqlDataTable, "EmployeeCellNo", True)
  28.             txtTelWork.DataBindings.Add("text", sqlDataTable, "EmployeeTelWork", True)
  29.             txtWorkExt.DataBindings.Add("text", sqlDataTable, "employeeWorkExt", True)
  30.             txtRoomNo.DataBindings.Add("text", sqlDataTable, "EmployeeRoomNo", True)
  31.             txtEmailAddress.DataBindings.Add("text", sqlDataTable, "EmployeeEmailAddress", True)
  32.             txtPostalAdd1.DataBindings.Add("text", sqlDataTable, "EmployeePostalAddress1", True)
  33.             txtPostalAdd2.DataBindings.Add("text", sqlDataTable, "EmployeePostalAddress2", True)
  34.             txtPostalAdd3.DataBindings.Add("text", sqlDataTable, "EmployeePostalAddress3", True)
  35.             txtPCode.DataBindings.Add("text", sqlDataTable, "EmployeePostalCode", True)
  36.             txtID.DataBindings.Add("text", sqlDataTable, "EmployeeIdNumber", True)
  37.             txtPassport.DataBindings.Add("text", sqlDataTable, "EmployeePassportNumber", True)
  38.             cbNature.DataBindings.Add("text", sqlDataTable, "EmployeeNature", True)
  39.             txtTaxNo.DataBindings.Add("text", sqlDataTable, "EmployeeTaxNumber", True)
  40.             dtDateOfBirth.DataBindings.Add("Text", sqlDataTable, "EmployeeDateBirth", True)
  41.             dtEngageDate.DataBindings.Add("Text", sqlDataTable, "EmployeeEngageDate", True)
  42.             dtIRP5Date.DataBindings.Add("Text", sqlDataTable, "EmployeeIRP5Date", True)
  43.             dtPensionStart.DataBindings.Add("Text", sqlDataTable, "EmployeePensionStartDate", True)
  44.             dtProvidentStart.DataBindings.Add("Text", sqlDataTable, "EmployeeProvidentStartDate", True)
  45.             dtMedicalStart.DataBindings.Add("Text", sqlDataTable, "EmployeeMedicalStartDate", True)
  46.             dtRAStart.DataBindings.Add("Text", sqlDataTable, "EmployeeRAStartDate", True)
  47.             dtStudyExpirey.DataBindings.Add("Text", sqlDataTable, "EmployeeStudyExpireyDate", True)
  48.             cbPaymentType.DataBindings.Add("text", sqlDataTable, "EmployeePaymentType", True)
  49.             cbTaxStatus.DataBindings.Add("text", sqlDataTable, "EmployeeTaxStatus", True)
  50.             cbNormalStatus.DataBindings.Add("text", sqlDataTable, "EmployeeNormalStatus", True)
  51.             dtResign.DataBindings.Add("Text", sqlDataTable, "EmployeeResignationDate", True)
  52.             txtResignReason.DataBindings.Add("Text", sqlDataTable, "EmployeeResignationReason", True)
  53.             dtContractExpirey.DataBindings.Add("Text", sqlDataTable, "EmployeeContractExpireyDate", True)
  54.             txtPensionE.DataBindings.Add("text", sqlDataTable, "EmployeePensionEmp", True)
  55.             txtPensionC.DataBindings.Add("text", sqlDataTable, "EmployeePensionCompany", True)
  56.             cbAdultDeps.DataBindings.Add("text", sqlDataTable, "EmployeeMedAdultDeps", True)
  57.             cbChildDeps.DataBindings.Add("text", sqlDataTable, "EmployeeMedChildDeps", True)
  58.             cbPaymentMethod.DataBindings.Add("text", sqlDataTable, "EmployeePayMethod", True)
  59.             txtBranchCode.DataBindings.Add("text", sqlDataTable, "EmployeeBankCode", True)
  60.             txtBankAccNumber.DataBindings.Add("text", sqlDataTable, "EmployeeBankAccNo", True)
  61.             cbAccountType.DataBindings.Add("text", sqlDataTable, "EmployeeBankAccType", True)
  62.             txtArea.DataBindings.Add("text", sqlDataTable, "EmployeeArea", True)
  63.             txtCategory.DataBindings.Add("text", sqlDataTable, "EmployeeCategory", True)
  64.             txtCostCentre.DataBindings.Add("text", sqlDataTable, "EmployeeCostCentre", True)
  65.             txtDepartment.DataBindings.Add("text", sqlDataTable, "EmployeeDepartment", True)
  66.             txtOccupation.DataBindings.Add("text", sqlDataTable, "EmployeeOccupation", True)
  67.             txtPayPoint.DataBindings.Add("text", sqlDataTable, "EmployeePayPoint", True)
  68.             sqlConnection.Close()
  69.  
  70.             ' Establish Navigation Manager
  71.             sqlManager = DirectCast(Me.BindingContext(sqlDataTable), CurrencyManager)
  72.         Catch sqlexc As SqlException
  73.             MsgBox(sqlexc.Message, MsgBoxStyle.OkOnly, "SQL Exception Error")
  74.         Catch exc As Exception
  75.             MsgBox(exc.Message, MsgBoxStyle.OkOnly, "Connection Failed")
  76.         End Try
  77.         SetText()
  78.     End Sub
the query used is
Expand|Select|Wrap|Line Numbers
  1. USE + My.Settings.sqlDataBaseName + vbCrLf & _
  2.                                         "SELECT * FROM EmployeeDetails", sqlConnection
now i have 2 tables, earnings and employees with a commen column called EmployeeID

now i want to for instance get information from both tables at the same time and update the values of both tables at the same time when im working with the dataTable. the tables information well some of it will need to update each other.

is this possible with a JOIN... ???
Apr 2 '08 #1
1 1052
ck9663
2,878 Expert 2GB
Is it possible to update two tables at the same time? Technically, no. Stored proc, batches still has to be processed sequentially (the first statement on the batch has to be executed before the second one). But there are work around: Use view.

Also if you're trying to access table or tables that would require you to build this query, I would recommend you consider views or table-valued functions.

-- CK
Apr 2 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: B. Fongo | last post by:
I learned MySQL last year without putting it into action; that is why I face trouble in formulating my queries. Were it a test, then you would have passed it, because your queries did help me...
2
by: Bruce Duncan | last post by:
I'm a bit new to MySQL (know MS SQL well...and that may be the problem...getting the syntax confused) and I'm having a join problem...can anyone offer some help? Here's my problem: I have table1...
3
by: Ike | last post by:
Oh I have a nasty query which runs incredibly slowly. I am running MySQL 4.0.20-standard. Thus, in trying to expedite the query, I am trying to set indexes in my tables. My query requires four...
1
by: Beachvolleyballer | last post by:
hi there anyone had an idea to join following 2 queries to 1???? ----- QUERY 1 --------------------------------------------- SELECT TMS_CaseF_2.Name AS TCDomain_0, TMS_CaseF_3.Name AS...
8
by: Matt | last post by:
Hello I have to tables ar and arb, ar holds articles and a swedish description, arb holds descriptions in other languages. I want to retreive all articles that match a criteria from ar and...
7
by: Greg | last post by:
I'm a quantitative securities analyst working with Compustat data (company fiscal reports and pricing feeds). My coworker came across a problem that we fixed, but I'd like to understand 'why' it...
3
by: Ian Boyd | last post by:
i know nothing about DB2, but i'm sure this must be possible. i'm trying to get a client to create a view (which it turns out is called a "Logical" in DB2). The query needs a LEFT OUTER JOIN, but...
12
by: Phil Powell | last post by:
<cfquery name="getAll" datasource="#request.dsn#"> SELECT U.userID, U.fname, U.lname, U.phone, U.lastLoggedIn, U.choiceId, U.experience, T.label AS teamLabel, R.label AS roleLabel FROM User U...
52
by: MP | last post by:
Hi trying to begin to learn database using vb6, ado/adox, mdb format, sql (not using access...just mdb format via ado) i need to group the values of multiple fields - get their possible...
12
by: Chamnap | last post by:
Hello, everyone I have one question about the standard join and inner join, which one is faster and more reliable? Can you recommend me to use? Please, explain me... Thanks Chamnap
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.