473,670 Members | 2,609 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How To Join Two Table in DataGridView

1 New Member
Hi.. I am Using This Code For Join Table..
Expand|Select|Wrap|Line Numbers
  1. con.Open()
  2.         Dim strSQL5 As String = "SELECT Fees_Transaction.Regno, Fees_Transaction.ST_Name, SUM(Fees_Transaction.Amount_Paid) as FTAmountPaid, SUM(FeesMaster.FeeAmount) As TotalFeeAmount FROM Fees_Transaction" & _
  3.             " INNER JOIN FeesMaster ON Fees_Transaction.Regno=FeesMaster.Regno WHERE  Fees_Transaction.class='" & cboClass.Text & "'  AND Fees_Transaction.FeeType=FeesMaster.FeeType " & _
  4.             "GROUP BY Fees_Transaction.Regno, Fees_Transaction.ST_Name"
  5.  
  6.  
  7.         Dim DaAp5 As New SqlDataAdapter(strSQL5, con)
  8.         Dim DSet5 As New DataTable
  9.         DaAp5.Fill(DSet5)
  10.         '========================================
  11.         With Me.DGV1
  12.             .Columns.Add("Regno", "RegNo")
  13.             .Columns.Add("ST_Name", "Student Name")
  14.             .Columns.Add("Amount_Paid", "Amount Paid")
  15.             .Columns.Add("Remaining", "Remaining")
  16.             .Columns.Add("TotalAmt", "Total Amount")
  17.             .Columns.Add("FeeType", "Fee Type")
  18.             .Columns.Add("Class", "Class")
  19.             .Columns.Add("Section", "Section")
  20.             .Columns(0).Width = 85
  21.             .Columns(1).Width = 250
  22.             .Columns(2).Width = 150
  23.             .Columns(3).Width = 150
  24.             .Columns(4).Width = 140
  25.             .Columns(5).Width = 150
  26.             .Columns(6).Width = 90
  27.             .Columns(7).Width = 90
  28.             ' .AllowUserToAddRows = False
  29.             .EditMode = DataGridViewEditMode.EditProgrammatically
  30.             .ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.TopCenter
  31.         End With
  32.  
  33.         For Each dr As DataRow In DSet5.Rows
  34.             Me.DGV1.Rows.Add()
  35.             With Me.DGV1.Rows(Me.DGV1.Rows.Count - 1)
  36.                 .Cells("Regno").Value = dr("Regno")
  37.                 .Cells("ST_Name").Value = dr("ST_Name")
  38.                 .Cells("Amount_Paid").Value = dr("FTAmountPaid")
  39.                 .Cells("TotalAmt").Value = dr("TotalFeeAmount")
  40.                 '  .Cells("FeeType").Value = "Total"
  41.                 '   .Cells("Class").Value = dr("Class")
  42.                 '   .Cells("Section").Value = dr("Section")
  43.             End With
  44.         Next
  45.  
  46.           con.Close()

But This Code is Woking.. Wht is my Problem.. I Use SUM both Table. Fees_Transcatio n SUM Function working For Two condition (regno and Feetype) and FeesMaster I Want Sum FeeAmount For Regno and Class wise but it's not sum that condition.. Please wht prb i did ..
Jan 24 '13 #1
1 4330
Rabbit
12,516 Recognized Expert Moderator MVP
Do you mean the code is not working? I have no idea what you are trying to say. Your english is unclear. Try posting sample data and results and reword what you're trying to do.
Jan 24 '13 #2

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

Similar topics

1
18521
by: Keith Simeon | last post by:
Hello all, I've recently started playing with Hibernate, and have a question regarding many-to-many relationships using a join or cross table (I've also heard these referred to as a transition tables). Given the following table structures : |------| |-------| |------| |a | | a_b | | b |
2
2017
by: bodleyhenley | last post by:
Please help me with this! :) I have a database of servers, one of the things I am recording information about is what software is on each server. Obviously this is a many to many so I have a join table which has a primary key of soft2servID and also has the server id and the software title id kinda like this ... ---->ServerID SoftwareTitleID<-------Softwaretable
6
6298
by: davegb | last post by:
I'm trying to create a self-join table to show the relationship between employee and supervisor. In another thread, I was advised to create a SupervisorID in the employee table, a separate Supervisor table, and join the Supervisor table to the Employee table and a copy of the Supervisor table to create the self-join. I can't figure out how to do this from reading Viescas or from researching it here. I can start a query and create 2 copies...
1
1623
by: LL | last post by:
Hi, My sql join two table, how to call the fill method? thanks. string sqlStr = "select * from table1, table2"; SqlDataAdapter myCommand = new SqlDataAdapter(sqlStr, myConnection);DataSet ds = new DataSet(); myCommand.Fill(ds, ?);
3
1686
by: CanFlightSim | last post by:
I am not very strong in databases, so you must forgive any obvious stupidity. After having a good look at our Sales Managemend database, we decided there is something basially wrong. Our Agents sell financials to only a few customers. The database was set up as... Table Table (Join) Table Agent (AgentID ) (AgentID)( >Customer(CustomerID)
3
2084
by: ssims | last post by:
I've been thinking about this problem for awhile, and can't seem to come up with a valid answer. I've got two tables, Surveys and Instructors. When a survey is completed there are one or two instructors associated with it (no surveys with zero, and no surveys with more than two). I'd like to take the data from both tables and join them to display the results. Right now I accomplish displaying all surveys with two instructors with the...
9
2412
by: koehlerc14 | last post by:
I'm trying to create a form that imports a text file and join zip code fields to our "Master" database x2. I import the txt file and name it based on a "strTableName" which includes the date, a title, and information I put in a textbox on the form. Up to this point it works well, but beyond that I cannot JOIN the fields as I don't know what to put in the table name. A second thing that I would like to do is add criteria to the queries if...
0
1127
by: RP | last post by:
I am using I want to transfer certain columns from my DataGridView (or table) to a text file. Though it is easy to read a row and write into a file, but I want that each column written is equally tabbed (spaced) with other columns. Even the values passed must properly align with the top values.
6
3799
by: BD | last post by:
Hi, all. I need to enforce a one-to-many relationship on 2 tables, with a join table. Say the join table contains account information. It has cust_no and acct_no. Both cust_no and acct_no are child FKs to other tables (no nulls will exist in these columns). Logically, one customer can have several accounts, but one account can
0
1163
by: Todd Nichols | last post by:
I have the main form for the "one" side of the relationship and a subform for the "many" side, linked by the primary key of the main table to the foreign key of the join table (the many-side table). But at the initial start, the form shows no entries in the subform because none have been created yet. How do I create the situation where the user can select from a list and make the proper entries into the join table in the subform? Otherwise,...
0
8471
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8815
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8592
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8661
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7421
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6216
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5686
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4213
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1795
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.