DataSource Controls :: Table / Database Design Theory - Return Faster Queries

Feb 5, 2010

In general terms, which way will require more server processing power and which way will return faster queries... if there is even a difference. The client's database is still on the dev MS SQL server but is essentially but the client has decided they want to collect two more fields of information. Both fields are going to be collection text data and probably varchar(300) will be sufficient for the column data types. Would it ultimately be more efficient to

Add two additional columns in the main table so the data is entered directly into each record, or Add an additional table (or two) with a foriegn key to the primary table that holds the info for each new field The SELECT statement for the main table could be modified to either add the new columns (a.NewColumn1 and a.NewColumn2) or it could contain nested SELECT statements that pull in the data from the other tables. Custom daisy-chained Insert or Update statements would be no problem and a cascade Delete relationship would take care of any deletions. I'm just trying to figure out which would be better from a performance standpoint?

View 3 Replies


Similar Messages:

DataSource Controls :: How To Check Two Queries Return Result Is Same

Feb 26, 2010

how to wrote stored procedure for check two queries result this result is same return true value its not same return false value

View 2 Replies

DataSource Controls :: LINQ To SQL - Multiple Queries Doesn't Return Any Results

May 25, 2010

I am working on asp.net 3.5 and in MVC using Linq to SQL classes. In my MVC project i am calling stored procedure using linq to sql that conatin query joining two tables.Below is my code in Partial class

[
Function(Name="dbo.GetUserWiseThreadDetail_SP")]
[ResultType(typeof(Thread))]
[ResultType(typeof(Reply))]
public
IMultipleResults GetUserWiseThreadDetail_SP([Parameter(DbType="VarChar(30)")]
string userID)
{
ExecuteResult result = this.ExecuteMethodCall(this,
(MethodInfo)(MethodInfo.GetCurrentMethod())), userID);
return ((IMultipleResults)(result.ReturnValue));
}

In one of the controller i have made one more class

public class
MypostIndexData
{
public
IEnumerable<Thread> Thrds {
get;
set; }
public
IEnumerable<Reply> Repls {
get;
set; }
public MypostIndexData(IEnumerable<Thread>
thrds,IEnumerable<Reply> repls)
{
this.Thrds=thrds;this.Repls=repls;
}
}

finally coding of controller action method

ForumDataContext pmforum = new
PMForumDataContext();
public
ActionResult MyPosts(string userId)
{
IEnumerable<Thread>thrds;
IEnumerable<Reply>repls;
IMultipleResults result = pmforum.GetUserWiseThreadDetail_SP(userId); (this satement doesnot give any result,if i execute stored proc in
sql it give the results)
thrds = result.GetResult<Thread>();
List<Thread> thrdlist =
new
List<Thread>(thrds);
repls = result.GetResult<Reply>();
List<Reply> replylist;
if (repls !=
null)
{
replylist = new
List<Reply>(repls);
}
return View(new
MypostIndexData(thrds,repls));

I am unable to understand why i am not getting any results?

View 5 Replies

DataSource Controls :: Return Number Of Rows Affected For Multiple Queries In One SQLCommand?

Feb 22, 2010

I am accepting query/queries from user (our support team) in a text box where user can enter only one query or multiple queries. I need to display result of all queries entered in the textbox. If it is SELECT statement then result of that statement in grid which is done. If UPDATE/INSERT/DELETE then total number of rows affected which is also done but if only one UPDATE/INSERT/DELETE statement is entered in the textbox.

If user enters 2 UPDATE statements and then a SELECT statement then how can I get number of rows affected for individual UPDATE statements just like SQL Server Qury Analyzer displays messages in its result pane.

e.g.

(6 row(s) affected) -- first UPDATE statement

(4 row(s) affected) -- second UPDATE statement

(16 row(s) affected) -- for SELECT statement (grid will also be displayed along with these messages).

I tried almost everything, SqlDataSource (returns count of first statement only), SqlCommand.ExecuteNonQuery and DataAdapter.Fill (returns count of last statement only).

View 3 Replies

ADO.NET :: Select Statement To Called Queries Table In Database?

Sep 2, 2010

anyone know that can we used select statement to called queries table in database or not?usually people used select statement to called common table in database.

View 4 Replies

DataSource Controls :: Database Design Tip Required?

Jun 4, 2010

I am building a page that displays a product's details, with the information being called from an MSSQL database.I would like to be able to have a variable number of features listed for each product, so for example, Product A has a list of 3 features, Product B has a list of 7 features, Product C has 2 features listed etc.I would like to avoid having a lot of NULLS in my database, and would prefer not to restrict the number of possible features listed.Is there a common way to tackle this problem? Is it simply a case of setting up a table just to store features?

View 2 Replies

DataSource Controls :: How To Get Query To Return Values From Xml Column In Table

Jun 24, 2010

I am trying to do a lookup in a table with a value stored in an xml column.

I tried this several ways but I can't get it to work.

Here is some code:

[Code]....

View 1 Replies

DataSource Controls :: How To Create A LINQ DataContext Class As Per Database Design

May 5, 2010

I want to create a LINQ DataContext Class as per Database Design. I getting a problem in some cases.

the syntax to bulid a LINQ class :

[Code]....

Here Table Name Is HardCoded But I my case my Table Name A Changed as Finicial Year Change.So How I Give The TableName As RunTime

View 8 Replies

DataSource Controls :: Having To Detach SQL Database After Changing And SQLdatasource In Design View?

May 14, 2010

everytime I modify an SQLdatasource using VS wizards, I have to dettach the mdf in VS's server exporer, then hit refresh in the browser, then get the applicaiton is offline error message please remove some pia file, but i usually just count to 12 and then hit refresh again and the page renders properlyhad scoured the forum on more than one ocasstiion, think it has something to do with the Admin rights within SQL, Ive tried the SQL server surface configuration tool, and add administrator stuff, but not sure if i should add (user to provision) something like the asp.net thing, or network services or ??also cant figure out where to view which administrators are actually on SQL server,

View 4 Replies

DataSource Controls :: Database Design - Display Results On A Web Page Via The Grid View

Mar 10, 2010

Not sure if this is for SQL or .net! I have 3 tables which looks like

table1
ID Name
1 Jon

and

table2
ID Number Job
1 1 IT
2 1 Web
3 1 Admin

table1
ID ContractType
1 Temp
1 Perm

An inner join makes one table with 3 rows (I excluding the ID from table 2 for the join) which is saved as a view

viewTable
ID Name Number Job ContractType
1 Jon 1 IT Temp
2 Jon 1 Web Temp
3 Jon 1 Admin Temp
4 Jon 1 IT Perm
5 Jon 1 Web Perm
6 Jon 1 Admin Perm

I want to display these results on a web page via the grid view. However, I don't want to show the user 6 times! I want to show the user name once, the contract type once and each Job! What is the best way to do this? Is there a fault with the database design already? I assume the easiest answer is to not join them in a view but query each section 3 times from the website but I'd rather 1 connection only!

View 10 Replies

DataSource Controls :: Database Table: Move Row To The Top Of The Table?

Sep 5, 2010

I have a table in my aspnet database. I added a bottom row "Not Selected", if the user doesn't select from a databound drop down list. This row is at the bottom, because I just added it to the table data. Is there any way to move this one row to the top of the table manually? There is not "cut" and "paste" when I select the whole row.

View 3 Replies

SQL Server :: Database Design / Create A Separate Table Which Will Contain The Translations For All 50 Tables?

Sep 28, 2010

I am working on a multi-lingual application Assume the following:

Database has 50 tables and application has to support 5 languages

Which is the best way to design the database:

1. Include a langugae column for each table. Repeat the values for each language. Say i have a country table which has 100 countries in it. Then my design will contain 500 rows (100 for each langugae)

2. Create a separate table which will contain the translations for all the 50 tables in with a foreign key to the parent table.

Which is more efficient out of the above two.

View 3 Replies

Do SQL Queries Towards An SQL 2005 Express Server And Format The Return Value To JSON?

Feb 19, 2010

I'm completely new to both VB.NET and JSON, and I'm trying to figure out how to do SQL queries towards an SQL 2005 Express server and format the return value to JSON. I got the queries working using this (perhaps very newbie-like) code;

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web.UI
Imports System.Web.UI.WebControls
Partial Public Class SQLConnect
Inherits System.Web.UI.Page
'Defines SQL variables
Dim con As New SqlConnection
Dim cmd As New SqlCommand
Dim dr As SqlDataReader
Dim ReadData As String
Dim i As Integer
Sub Click(ByVal s As Object, ByVal e As EventArgs)
'Define SQL address, database, username and password
con.ConnectionString = "Data Source=localhostSQLEXPRESS;Initial Catalog=tempdb;User ID=tesst;Password=test"
Try
'Initialize connection
con.Open()
'Specify SQL query
cmd = New SqlCommand("SELECT * FROM Member", con)
'Execute query, dump result array into variable
dr = cmd.ExecuteReader()
messageLabel.Text = "<br />Connection established<br />"
While (dr.Read)
i = 0
For i = 0 To dr.FieldCount - 1
'Dump query results into a variable
ReadData += dr.Item(i).ToString
Next
End While
'Print query results
messageLabel2.Text = ReadData
'Close connection
con.Close()
Catch ex As Exception
messageLabel.Text = "<br />Connection failed<br />"
End Try
End Sub
End Class

I have been looking at this, and I would love to see some code examples using this class or any other good method.

View 3 Replies

DataSource Controls :: How To Write SQL Queries

Mar 5, 2010

SELECT 1000000*QuantityNC/Quantity AS PPM FROM [table1] However I need my WHERE clause to do thisI need the above calculation depending on BusUnit, which is linked to PartNumber, which is in the above table. also it has to be by Company (which is selected from a dropdown). And also based on the current month and year.

PartNumber and CompanyName are in [table1]
BusUnitID, PartNumber, SupplierID, are in tblParts
BusUnitID and BusUnit are in tblBusUnits

View 2 Replies

DataSource Controls :: Run Queries From Website?

Jun 28, 2010

I need to fire sql queries in my website and get the results from the Database. for example: I will give select * from emp in a text box. It shud return the results for me. DO any of u have a sample/links of such application, through which i will be able to implement in my application share me the links/sources/app if u have any.

View 2 Replies

DataSource Controls :: Getting The Row Counts Of A Table In The Database In VB?

Jul 8, 2010

how do I get the Row count from a table CustomerDatabaseTables in the Database.What I want to do is if the Row Count is greater than 5 then I want to disable a buttonCREATE NEW USER. But I am not able to figure out a way for doing it.Can anyone post the code for the same in VB.

View 2 Replies

DataSource Controls :: How To Bring The Particular Result Through Queries

Feb 11, 2010

(ie.)C-Chennai
B-Bombay
-Hydrabad
A-Andhra
K-Karnataka

It may comes any order but (cbhak) is constant. i need to bring this in query, i dont want to use any funtionHow can i acheive this result

View 2 Replies

DataSource Controls :: Perform Sql Queries Onto Vb.net And Display Them?

Apr 26, 2010

I get from SQL Server Server Data. I need to use datas form 2 colums of my SQL query for a VB.NET. The VB.NET need 2 values for both colums and produce 1 answer. I what to display the value on the same line instead of the 2 1st values. How can i store the 2 colums wich lot of SQL values on my vb.net script and diplay the result with the other data from the SQL query ?

View 3 Replies

DataSource Controls :: Test If Table Exists In Database Using SQL?

Jun 9, 2010

I need to somehow test if a table exists in a database. If it does not then I need to create the table. How can I test for existence of a table using SQL? It seems like some type of SQL logic is needed?

View 2 Replies

DataSource Controls :: Add A New Column To An Existing Database Table!?

Jan 13, 2010

I have a table with several columns i created,

How can i add a new column and specify its data type now? i using sql server and Gridview.

I tried to add one using GridView but it shows me columns called edit delete something is not like my bound fields i created early.

View 1 Replies

DataSource Controls :: How To Select A Field Value From A Database Table

Jul 5, 2010

I need to select a field value from a database table. If the value read is '1' then I need a 'Y' to display as output in the select statement. I haven't figured out how to do this yet and queries I tried that did not work.

select IsIata from Table_1 CASE WHEN (IsIata = '1') THEN 'Y'
select IsIata CASE WHEN (IsIata = '1') THEN 'Y' from Table_1

View 4 Replies

DataSource Controls :: How To Truncate A String In A Database Table

Jun 14, 2010

I get an error when I try to update a row in an SQL database table with a string of fewer characters than were previously stored. I attempted to correct this problem by using the "PadRight" function in my C# webpage event handler to fill in the remaining characters with spaces, but I don't seem to be able to make that work. So, what do I do when I want to store fewer characters in a table row that has more characters previously stored in it?

View 2 Replies

DataSource Controls :: Insert List To Database Table?

Jul 4, 2010

how can I insert a list (of int) to table?

View 1 Replies

DataSource Controls :: Get Id Of Last Image Inserted Into Sql Database Table?

Jul 3, 2010

I have this image upload code...that works....but I need a code to get the Id of the image that i just uploaded..

Protected Sub ImageButton_AddImage_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton_AddImage.Click
Dim IntLength As Integer
Dim ArrContent As Byte()

[Code]....

View 1 Replies

DataSource Controls :: Compare Changes Of A Database Table Between Dates?

Apr 28, 2010

I have a web form that displays the results from a table. How can I compare the table between dates and display the differences of the table?

e.g. today 790 items, and two days ago there were 745 items and this is what is the difference;

xxx
yyy
ggg
hhh
aaa
etc.

View 7 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved