Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Multiple DataSources within Single DataBindMultiple DataSources within Single DataBind
Previous
 
Next
New Post
10/9/2007 1:13 PM
 



I am presently using the following code for databinding and placing in a gridview display: 

Dim mySqlString As New StringBuilder()
mySqlString.Append(
"SELECT ClientName, Product, Equip, Score, Checkbox ")
mySqlString.Append(
"FROM {databaseOwner}{objectQualifier} MODULNAME ")
mySqlString.Append(
"ORDER BY ClientName DESC")
Dim myParam As SqlParameter = New SqlParameter("@SearchString", SqlDbType.VarChar, 150)
myParam.Value = SearchString
Me.GridView2.DataSource = CType(DataProvider.Instance().ExecuteSQL(mySqlString.ToString(), myParam), IDataReader)
Me.GridView2.DataBind()

What I am wondering, is how can I add an additional column into this same gridview, which will grab from another database table?
What are all the "need to knows" for something like this?



Feedback Appreciated,

-machina12

 

 

 
New Post
10/9/2007 4:08 PM
 

You would alter the Query to join to the other table.



Michael Washington
http://ADefWebserver.com
www.ADefHelpDesk.com
A Free Open Source DotNetNuke Help Desk Module
 
New Post
10/12/2007 2:29 PM
 



Very Well. Appreciated.
Got it to work using the following:

("SELECT Employees.EmployeeID, Employees.FirstName, Employees.LastName, Products.Product ")
(
"FROM {databaseOwner}{objectQualifier} Employees, Products WHERE Employees.EmployeeID = Products.EmployeeID ")
(
"ORDER BY LastName ASC")

It works, but I noticed it happened to grab duplicate data. It almost seems like it is pulling double the data, expcept some of the data that has an odd number of inputs. The only thing I can figure is because the formula is looking for Employees.EmployeeID = Products.EmployeeID  ,and it may be listing twice becuase it is trying the equation both ways...still doesn't explain some of the odd numbered results.
Using: LIMIT doesn't seem to be what I am looking for either.

How would tell the sql query to only grab duplicated data once within databind? 



Feedback appreciated,

-machina12

 

 
New Post
10/12/2007 5:04 PM
 

("SELECT Employees.EmployeeID, Employees.FirstName, Employees.LastName, Products.Product ")
("FROM {databaseOwner}{objectQualifier} Employees, Products WHERE Employees.EmployeeID = Products.EmployeeID ")

("Group by Employees.EmployeeID, Employees.FirstName, Employees.LastName, Products.Product ")
("ORDER BY LastName ASC")



Michael Washington
http://ADefWebserver.com
www.ADefHelpDesk.com
A Free Open Source DotNetNuke Help Desk Module
 
New Post
10/14/2007 1:25 PM
 

 

Try this:

("SELECT DISTINCT Employees.EmployeeID, Employees.FirstName, Employees.LastName, Products.Product ")
("FROM {databaseOwner}{objectQualifier} Employees")

("LEFT OUTER JOIN Products ON Employees.EmployeeID = Products.EmployeeID")
("ORDER BY LastName ASC")

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Multiple DataSources within Single DataBindMultiple DataSources within Single DataBind


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out