Showing posts with label membership. Show all posts
Showing posts with label membership. Show all posts

Friday, March 30, 2012

how can i connect tables.

Hi,

How do i connect tables so they are interrelated to each other. like the asp.net 2.0 membership tables have the "id"

and how can i use that?

i have multiple tables that are all connected.

like i have a table for profile. and images

profile with include their profile, while images will include there avatar.

now when i display there profile on page, i need to grab the data from both the profile table and avatar.

right now i've been using the "JOIN" statement. but is tehre any other way

only join is made in sql for getting information from interrelated tables in database.

use inner/outer as per your requirement.

thanks

vishal sharma

|||

Hello my friend,

The JOIN is the "de-facto" way of getting related data and saves you from having to do 2 or more separate queries. Some info on joins: -

FROM profile INNER JOIN images ... - if profile does not have an image or vice versa, no records will be returned.

FROM profile LEFT OUTER JOIN images - if profile exists but image does not, a record will be returned with the image fields as NULL. Profile record must exist.

FROM profile RIGHT OUTER JOIN images - if image exists but profile does not, a record will be returned with the profile fields as NULL. Image record must exist.

Kind regards

Scotty

|||

masfenix:

right now i've been using the "JOIN" statement. but is tehre any other way

- Yeah, you can do a SubSelect if you are doing something simple like getting 1 value from 1 table instead of JOINing to that table.

Example:

SELECT
*,
(SELECT TOP 1 Blah FROM myOtherTable WHERE myOtherTable.UserID = myTable.UserID)
FROM
dbo.MyTable

|||

so is what is it?

is it not join?

|||

join is better option.

other thing you can do is

select tableA.field, tableB.field where tableA.Id = tableB.Id something like that.

thanks,

satish

|||

You can see an example of when you would use JOINing or SubSelects of what I posted above can be found in this article :http://www.singingeels.com/Articles/How_To_Maintain_Customer_Payment_History.aspx

Sunday, February 19, 2012

Hosting aps.net website, sql server 2005 db in App_data or outsite App_data?

I've started with the development of a website which will use a sql server 2005 database. I want to use the asp.net membership and roles functionality. In the end the website will be hosted by a hosting company.

What is the best way to store the database? In the App_data folder or outstide the App_data folder?

Second, do hosting companies support placing sql server databases stored into the App_data folder?

1) app_data - not good idea. the database file in app_data folder maybe will work for you intranet project but in my opinion it is not good idea. It works great when you want to "play" with VWD and SQL express... BTW SQL express is GREAT so use it but do not create databse file ! - just login to your SQL server and create db. When you finish your project backup db and restore on live server.

2) no ! i mean not the one i know :) i work with 10 diffrent hosts and NO they don't. I guess if you will look for one you will find one... but most hosting companies offers full SQL 2005 servers and they don't support app_data folders. What some hosting companies do, they offer tools that will allow you to copy/upgrade your db to SQL 2005

hope this helps