Showing posts with label datagrid. Show all posts
Showing posts with label datagrid. Show all posts

Wednesday, March 7, 2012

Displaying Data in Datagrid from a Normalized Set of Tables

Ok, I'm fairly new to .NET and even newer to the whole database concept. But, don't run away yet, I'm no idiot and I shouldn't have too hard of a time understanding your responses if you're kind of enough to give them. That being said, here's my dilemma:

I'm trying to make a database of all the movies I own, the actors in them and the genre (s) they belong to. I have a set of tables that are in the 2NF (I think). I have a movies table, an actors table, a genres table, and two tables called movies_actors and movies_genres with primary-foreign key relationships to pull it all together (e.g. movie_id 1 has two entries in movies_genres, one for Action and one for Drama).

My problem arises that when execute my monster query to pull ALL the data on one movie, I get a row returned for every combination of Genres and Actors in a movie. Example:

movie_id movie_title comments actor_first actor_last genre_name

1 Casino blah blah Robert DeNiro Action

1 Casino blah blah Robert DeNiro Drama

1 Casino blah blah Joe Pesci Action

1 Casino blah blah Joe Pesci Drama

And here's the query that produced that:

1SELECT movies.movie_title, movies.comments, actors.actor_first,2actors.actor_last, genres.genre_name3FROM moviesINNERJOIN movies_actorsON movies.movie_id = movies_actors.movie_id4INNERJOIN actorsON movies_actors.actor_id = actors.actor_id5INNERJOIN movies_genresON movies_genres.movie_id = movies.movie_id6INNERJOIN genresON movies_genres.genre_id = genres.genre_id

So, I want to put all the actors for one movie into the same cell in the datagrid (same with the genres) and still keep it sortable by actor or genre. Is this possible with the .NET 2.0 datagrid? Do I have some fundamental misunderstanding of how my tables should be structured? Am I just really far off and acting like a n00b?

Can you provide some sample data from each of the tables (preferably with INSERT scripts) and expected output so it makes it easier for us to understand what you want and what you are doing to get what you want.

|||

Hi,

Your design and query looks ok, and query works as it supposed to, but I think your goal is a little bit different from what you are getting form your query.

To make it work as you want you will need to query only movie table first retrieving titles, than your data grid should have two template fields for actors and for genres which could contain a nested databound controls inside like a repeater or dataview, and those controls should have their own datasources that would rely on separate queries. For example:

first (master) query would look like this: select movie_id, movie_title, comments from movies.

the query for list of actors: select actor_first, actor_last from actors join movies_actors on movies_actors.actor_id = actors.actor_id where movies_actors.movie_id = @.movieId (this is a parameter for binding your nested data control that I mentioned about before)

and you would have similar query for genres.

|||

Ok, here's what a few basic INSERT's would look like on each of the tables:

movies table:

INSERT INTO movies (movie_id, movie_title,year, comments)
VALUES (1,'Casino', 1995,'Pretty cool movie')

actors table:

INSERT INTO actors (actor_id, actor_first, actor_last)--I think I might actually combine actor_first and actor_last
VALUES (1,'Robert','DeNiro'), (2, 'Joe' , 'Pesci')
movies_actors
INSERT INTO movies_actors (movie_id, actor_id)
VALUES (1, 1), (1,2)
genres
INSERT INTO genres (genre_id, genre_name)
VALUES (1,'Action'), (2,'Drama')
movies_genres
INSERT INTO movies_genres (movie_id, genre_id)
VALUES (1, 1), (1,2)
 So, that's just a little, but hopefully that's enough that you see how the tables are structured? If not, let me know and I can certainly elaborate further.
I'd like the output of the table to look something like this:
movie_idmovie_titleyearcommentsactorsgenres
1 Casino1995Cool movieRobert DeNiro,Action, Drama
Joe Pesci

And, preferably, I'd still like to be able to sort by genre or actor, so if you sorted by Action this movie would still come up (i.e. you wouldn't need to sort by movies that are action AND drama).I guess if I wasn't such a stubborn person I'd have just said to hell with the normalized tables and put this all in one table (or I would have just bought software that does the same thing).

But, I know my table structure is supposed to be the way to do it ... like if I have to update the spelling of an actor's name this will cause the least trouble. (edit: yuck. Nuked the styling in the last part here somehow. Sorry.)



|||

--Prepare the tables and insert sample dataCreate table movies (movie_idint, movie_titlevarchar(100), [year]int, commentsvarchar(100))INSERT INTO movies (movie_id, movie_title, [year], comments)VALUES (1,'Casino', 1995,'Pretty cool movie') goCreate table actors (actor_idint, actor_firstvarchar(100), actor_lastvarchar(100))INSERT INTO actors (actor_id, actor_first, actor_last)Select 1,'Robert','DeNiro'unionallselect 2,'Joe' ,'Pesci' goCreate table movies_actors (movie_idint, actor_idint)INSERT INTO movies_actors (movie_id, actor_id)Select 1, 1unionallselect 1,2 gocreate table movies_genres (movie_idint, genre_idint )INSERT INTO movies_genres (movie_id, genre_id)Select 1, 1unionallselect 1,2create table genres (genre_idint, genre_namevarchar(100))INSERT INTO genres (genre_id, genre_name)Select 1,'Action'unionallSelect 2,'Drama'gocreate table movies_genres (movie_idint, genre_idint )INSERT INTO movies_genres (movie_id, genre_id)Select 1, 1unionallselect 1,2create table genres (genre_idint, genre_namevarchar(100))INSERT INTO genres (genre_id, genre_name)Select 1,'Action'unionallSelect 2,'Drama'Go--Create the required functionsCreate function dbo.fnGetActors( @.Movieidint)ReturnsVarchar(500)AsBeginDeclare @.Actorsvarchar(500)Set @.Actors =''Select @.Actors = @.Actors +', ' + (A.actor_first +' ' + A.actor_last )From movies_actors MAJOIN Actors Aon MA.actor_id = A.actor_idWHERE MA.movie_id = @.MovieidReturnRIGHT(@.Actors,LEN(@.Actors) - 1 )EndGoCreate function dbo.fnGetGenres( @.Movieidint)ReturnsVarchar(500)AsBeginDeclare @.Genresvarchar(500)Set @.genres =''Select @.genres = @.genres +', ' + genre_nameFrom movies_genres MGJOIN genres GON MG.genre_id = G.genre_idWHERE MG.movie_id = @.MovieidReturnRIGHT(@.genres,LEN(@.genres) - 1 )End--Write the queryselect M.* , Actor = dbo.fnGetActors(M.movie_id ) , Genres = dbo.fnGetGenres(M.movie_id)from movies M
|||

First off, thanks a ton for the responses guys!

Robert, I understand what you're saying. I guess I just didn't know I could make a nested control with its own datasource. Is it possible you have a link to an example of something like this? I've tried a couple searches but I think I have my terminology a little mixed up ...


NDinakar, IthinkI understand your code, but what would that output look like? Would it really put both matching actors within the same cell?

|||

Hi,

Dinakar's idea is to put everything together on the database layer and it would perform much better since you would get what you want with only one database connection.

Nesting data controls gives you more flexibility in terms of presentation and data manipulation on the web form (for example actor names could be presented as links that would point to a page showing their biography etc.), however since each control has its own datasource the select statements for actors and genres would be executed for each movie row in the gridview.

I do not have any example of nested controls, but if you send me an sql script for creating your tables I could produce a simple example - it's very easy.

|||

newmanium:

NDinakar, IthinkI understand your code, but what would that output look like? Would it really put both matching actors within the same cell?

Well, why dont you give it a try. Promise, the script will not kill your server. I spent 20 mins creating the scripts. It will take you a fraction of that to cut/paste the script and check it out.Smile

|||

I actually did envision having more control over my presentation on the web form, so perhaps the nested control would work better for me. I was hoping to have a hyperlink on every actor's name so I could click on it and execute a new query for just the movies containing that actor.

But yeah, if you could give me a simple example that would tremendous. Here's what my tables look like:

CREATETABLE`actors`(

`actor_id`INT(5)NOTNULLAUTO_INCREMENTPRIMARYKEY,
`actor_name`VARCHAR(50)NOTNULL

)ENGINE=innodb;

CREATE TABLE ' movies' (
'movie_id' INT (5) NOT NULL AUTO_INCREMENT PRIMARY KEY,
'movie_name' VARCHAR (50) NOT NULL,
'comments' TEXT NOT NULL,
'year' INT (4) NOT NULL
) ENGINE = innnodb;

CREATE TABLE 'movies_actors' (
'movie_id' INT (5) NOT NULL AUTO_INCREMENT PRIMARY KEY,
'actor_id' INT (5) NOT NULL
) ENGINE = innodb;

CREATE TABLE 'genres' (
'genre_id' INT (5) NOT NULL AUTO_INCREMENT PRIMARY KEY,
'genre_name' VARCHAR (50) NOT NULL
) ENGINE = innodb;

CREATE TABLE 'movies_genres' (
'genre_id' INT (5) NOT NULL,
'movie_id' INT (5) NOT NULL
) ENGINE = innodb;

P.S. I typed that by hand just now without a client, so I apologize if it has an error or two.

|||

And Dinakar, I will try out your script :) I'm at work right now so I can't try it out very well, but I very much appreciate your time.

Friday, February 24, 2012

display summary week total rows from sql database

(I moved this thread from datagrid area)

I have a sql database that has individual records consisting of name, date, hours worked among other fields.

Date and name is part of a unique identifier, so there can NOT be two records for the same person for the same date.

My users need a grid view that displays days worked in ONE LINE per user. I have gotten close, but can't quite get the last part. Ive tried group by, distinct, and with rollup and no luck.

TABLE:

dan 12/13/2012 12:00:00 AM9.123dan 12/14/2012 12:00:00 AM3.123123cara 12/12/2012 12:00:00 AM4.222cara 12/16/2012 12:00:00 AM3.3333cara 12/17/2012 12:00:00 AM2

CODE:

Select distinct(name),
(select (y.hours) from dbo.testtime y where y.name=YT.name AND y.hours = YT.hours and datename(dw, date)='Sunday')as Sunday,
(select (y.hours) from dbo.testtime y where y.name=YT.name AND y.hours = YT.hours and datename(dw, date)='Monday')as Monday,
(select (y.hours) from dbo.testtime y where y.name=YT.name AND y.hours = YT.hours and datename(dw, date)='Tuesday')as Tuesday,
(select(y.hours) from dbo.testtime y where y.name=YT.name AND y.hours =YT.hours and datename(dw, date)='Wednesday')as Wednesday,
(select(y.hours) from dbo.testtime y where y.name=YT.name AND y.hours =YT.hours and datename(dw, date)='Thursday')as Thursday,
(select (y.hours) from dbo.testtime y where y.name=YT.name AND y.hours = YT.hours and datename(dw, date)='Friday')as Friday,
(select(y.hours) from dbo.testtime y where y.name=YT.name AND y.hours =YT.hours and datename(dw, date)='Saturday')as Saturday,
(select sum(hours)from dbo.testtime y where y.name=YT.name AND y.hours = YT.hours) as Total
from dbo.testtime YT
group by date, name, hours

RESULTS:

cara NULL NULL NULL 4.222 NULL NULL NULL 4.222
cara NULL 2 NULL NULL NULL NULL NULL 2
cara 3.3333 NULL NULL NULL NULL NULL NULL 3.3333
dan NULL NULL NULL NULL NULL 3.123123 NULL 3.123123
dan NULL NULL NULL NULL 9.123 NULL NULL 9.123

Like I said, I am SO close, I just need it to look like;

NAME SUN MIN TU WED TH FR SA TOTAL

cara 3.333 2 4.222 9.555
dan 9.125 3.125 12.5

TIA

dan



You need to create a table variable with columns of name, Sun-Sat columns to accumulate the data into. You can then select from that table the required summary.

|||

OK, sounds good.

Um, what is a table variable?

Is that like a view?

can you give me psudo-code to work with?

thanks MUCH!

Dan

|||

With table create script of SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TimeData](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Name] [varchar](50) COLLATE Latin1_General_CI_AS NOT NULL,
[Date] [datetime] NOT NULL,
[Hours] [decimal](8, 6) NOT NULL,
CONSTRAINT [PK_TimeData] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF

Table insert script of

INSERT INTO TimeData(Name, Date, Hours)
VALUES ('dan', CONVERT(DATETIME,'13/Dec/2012 12:00:00 AM'), 9.123) -- I am in the UK, hence the change of date format
INSERT INTO TimeData(Name, Date, Hours)
VALUES ('dan', CONVERT(DATETIME,'14/Dec/2012 12:00:00 AM'), 3.123123)
INSERT INTO TimeData(Name, Date, Hours)
VALUES ('cara', CONVERT(DATETIME,'12/Dec/2012 12:00:00 AM'), 4.222)
INSERT INTO TimeData(Name, Date, Hours)
VALUES ('cara', CONVERT(DATETIME,'16/Dec/2012 12:00:00 AM'), 3.3333)
INSERT INTO TimeData(Name, Date, Hours)
VALUES ('cara', CONVERT(DATETIME,'17/Dec/2012 12:00:00 AM'), 2)

|||

The TSQL

DECLARE @.MyTableVar table(
[Name] VARCHAR(5) NOT NULL,
Sun [decimal](8, 6) NOT NULL DEFAULT ((0)),
Mon [decimal](8, 6) NOT NULL DEFAULT ((0)),
Tue [decimal](8, 6) NOT NULL DEFAULT ((0)),
Wed [decimal](8, 6) NOT NULL DEFAULT ((0)),
Thu [decimal](8, 6) NOT NULL DEFAULT ((0)),
Fri [decimal](8, 6) NOT NULL DEFAULT ((0)),
Sat [decimal](8, 6) NOT NULL DEFAULT ((0)),
Total [decimal](8, 6) NOT NULL DEFAULT ((0))
);
DECLARE @.NAME VARCHAR(50)
DECLARE @.DATE DATETIME
DECLARE @.HOURS decimal(8, 6)
DECLARE xCURSOR CURSOR FOR
SELECT Name, Date, Hours FROM TimeData
OPEN xCURSOR
FETCH xCURSOR INTO @.NAME, @.DATE, @.HOURS
WHILE @.@.FETCH_STATUS = 0
BEGIN
IF NOT EXISTS(SELECT * FROM @.MyTableVar WHERE [Name] = @.NAME)
INSERT INTO @.MyTableVar([Name]) VALUES (@.NAME)
IF datename(dw, @.DATE)='Sunday'
UPDATE @.MyTableVar SET Sun = Sun + @.HOURS, Total = Total + @.HOURS WHERE [Name] = @.NAME
IF datename(dw, @.DATE)='Monday'
UPDATE @.MyTableVar SET Mon = Mon + @.HOURS, Total = Total + @.HOURS WHERE [Name] = @.NAME
IF datename(dw, @.DATE)='Tuesday'
UPDATE @.MyTableVar SET Tue = Tue + @.HOURS, Total = Total + @.HOURS WHERE [Name] = @.NAME
IF datename(dw, @.DATE)='Wednesday'
UPDATE @.MyTableVar SET Wed = Wed + @.HOURS, Total = Total + @.HOURS WHERE [Name] = @.NAME
IF datename(dw, @.DATE)='Thursday'
UPDATE @.MyTableVar SET Thu = Thu + @.HOURS, Total = Total + @.HOURS WHERE [Name] = @.NAME
IF datename(dw, @.DATE)='Friday'
UPDATE @.MyTableVar SET Fri = Fri + @.HOURS, Total = Total + @.HOURS WHERE [Name] = @.NAME
IF datename(dw, @.DATE)='Saturday'
UPDATE @.MyTableVar SET Sat = Sat + @.HOURS, Total = Total + @.HOURS WHERE [Name] = @.NAME
FETCH xCURSOR INTO @.NAME, @.DATE, @.HOURS
END
SELECT * FROM @.MyTableVar
CLOSE xCURSOR
DEALLOCATE xCURSOR

gives

Name Sun Mon Tue Wed Thu Fri Sat Total
-- --- --- --- --- --- --- --- ---
dan 0.000000 0.000000 0.000000 0.000000 9.123000 3.123123 0.000000 12.246123
cara 3.333300 2.000000 0.000000 4.222000 0.000000 0.000000 0.000000 9.555300

Obviously a Cursor is not particularly efficient and needs to be eliminated. Also the Name column would need to be indexed (if possible) if there are more than 10 rows.

|||

TAT~

THat is awsome!
Thank you SO much for your efforts.

I ventured out on my own and came up with the following (I actually changed it to look at a test/prod table, so name is UserName)

But the code actually WORKEd!

Here it is, if youd care to comment:

--make var tqable

Declare @.tempweek TABLE
(UserName nvarchar(50), Sunday DECIMAL(8,6), Monday DECIMAL(8,6), Tuesday DECIMAL(8,6), Wednesday DECIMAL(8,6), Thursday DECIMAL(8,6), Friday DECIMAL(8,6), Saturday DECIMAL(8,6), Total DECIMAL(8,6))

--fill table

INSERT INTO @.tempweek
SELECT UserName,
(SELECT (y.HoursWorked) from db_owner.PS_HR_Hrs y WHERE y.UserName=YT.UserName AND y.DateWorked=YT.DateWorked AND datename(dw, DateWorked)='Sunday')AS Sunday,
(SELECT (y.HoursWorked) from db_owner.PS_HR_Hrs y WHERE y.UserName=YT.UserName AND y.DateWorked=YT.DateWorked AND datename(dw, DateWorked)='Monday')AS Monday,
(SELECT (y.HoursWorked) from db_owner.PS_HR_Hrs y WHERE y.UserName=YT.UserName AND y.DateWorked=YT.DateWorked AND datename(dw, DateWorked)='Tuesday')AS Tuesday,
(SELECT (y.HoursWorked) from db_owner.PS_HR_Hrs y WHERE y.UserName=YT.UserName AND y.DateWorked=YT.DateWorked AND datename(dw, DateWorked)='Wednesday')AS Wednesday,
(SELECT (y.HoursWorked) from db_owner.PS_HR_Hrs y WHERE y.UserName=YT.UserName AND y.DateWorked=YT.DateWorked AND datename(dw, DateWorked)='Thursday')AS Thursday,
(SELECT (y.HoursWorked) from db_owner.PS_HR_Hrs y WHERE y.UserName=YT.UserName AND y.DateWorked=YT.DateWorked AND datename(dw, DateWorked)='Friday')AS Friday,
(SELECT (y.HoursWorked) from db_owner.PS_HR_Hrs y WHERE y.UserName=YT.UserName AND y.DateWorked=YT.DateWorked AND datename(dw, DateWorked)='Saturday')AS Saturday,
(SELECT SUM(HoursWorked)from db_owner.PS_HR_Hrs y WHERE y.UserName=YT.UserName AND y.HoursWorked = YT.HoursWorked) AS Total
from db_owner.PS_HR_Hrs YT


--select data

select UserName , sum(sunday)as Sunday, sum(monday) as Monday, sum(tuesday)as Tuesday, sum(wednesday)asWednesday, sum(thursday)as Thursday, sum(friday)as Friday, sum(saturday)as Saturday, sum(total) as Total
from @.tempweek
group by UserName

|||

Your solution will probably be faster as you do not use a CURSOR! Both solutions will be gluttons for memory for the few milliseconds they run, so as always, never stint on the RAM for a server hosting SQL Server.

Friday, February 17, 2012

Display image stored in SQL

Hello group
Is there a way to display an image stored in SQL without using a datagrid? I am using vb, the very few examples I do find open the image in a window by its self. Also is there a way find the height and width of an image stored in the database and the ability to change the image size? Example – when an image is uploaded to the database I would like a thumbnail to be created and also stored in the database. Any ideas please help.
Michaelyup. there's a way to do all of the above. Man. Your questions are those with long long long responses. :-\


public Image ResizeImage(ref Image oImage, int ResizedWidth, int ResizedHeight, float Opacity)
{

// resize image.
System.Drawing.Bitmap oReturnVar = new System.Drawing.Bitmap(
ResizedWidth,
ResizedHeight,
System.Drawing.Imaging.PixelFormat.Format24bppRgb);

System.Drawing.Graphics oPhoto = System.Drawing.Graphics.FromImage(oReturnVar);

oPhoto.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
oPhoto.DrawImage(oImage,
new Rectangle(
-1,
-1,
ResizedWidth + 2,
ResizedHeight + 2),
0,
0,
oImage.Width,
oImage.Height,
System.Drawing.GraphicsUnit.Pixel,
CreateImageAttribute(Opacity));

oPhoto.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
oPhoto.Dispose();
oPhoto = null;
oImage.Dispose();
oImage = null;
return oReturnVar;
}

That's c#, but should be easy enough to do in vb.

http://www.dotnetspider.com/Technology/QA/ViewQuestion.aspx?QuestionId=117

the above link has a lot of examples on how to do the rest of what you wanted. Now your best bet is to learn the syntax of c#. Not really so you can write it, but more so you can be flexible in reading all the articles provided.

I like Dino Esposito's sample..


SqlCommand cmd = new SqlCommand(cmdText, cn);

MemoryStream ms = new
MemoryStream();

// 78 is the size of the OLE header
// for Northwind images.
// There's no header in PUBS as PUBS
// just contains the raw image bits.
int offset = 78;

cn.Open();
byte [] img = (byte[])
cmd.ExecuteScalar();
ms.Write(img, offset,
img.Length-offset);
cn.Close();

Bitmap bmp = null;
bmp = new Bitmap(ms);
Response.ContentType = "image/gif";
bmp.Save(Response.OutputStream,
ImageFormat.Gif);
ms.Close();

Tuesday, February 14, 2012

display data using mxdatagrid or datagrid in webmatrix

what i'm trying to do is simply display the contents of the sqldata to verify that it works. and it doesn't. i have created a simple database named 'test' and table 'list' with fields: 'name' and 'id'. i have made 3 records as follows:

NAME ID
name1 1
name2 2
name3 3

what i did is connect to the database, click and drag it over to the canvas and codes were generated. if i run it, by default it should show all the contents of the table, correct? well, it isn't. i've tried it using a datagrid and it still doesn't work.

is there an access problem with the database? or, what settings to have to make/change in my sql server? by the way, i have MSDE.


<%@. Page Language="VB" %>
<%@. Register TagPrefix="wmx" Namespace="Microsoft.Matrix.Framework.Web.UI" Assembly="Microsoft.Matrix.Framework, Version=0.6.0.0, Culture=neutral, PublicKeyToken=6f763c9966660626" %>
<script runat="server"
' Insert page code here
'
Function test() As System.Data.IDataReader
Dim connectionString As String = "server='(local)'; trusted_connection=true; database='test'"
Dim dbConnection As System.Data.IDbConnection = New System.Data.SqlClient.SqlConnection(connectionString)

Dim queryString As String = "SELECT [list].* FROM [list]"
Dim dbCommand As System.Data.IDbCommand = New System.Data.SqlClient.SqlCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection

dbConnection.Open
Dim dataReader As System.Data.IDataReader = dbCommand.ExecuteReader(System.Data.CommandBehavior.CloseConnection)

Return dataReader
End Function

</script>
<html>
<head>
</head>
<body>
<form runat="server">
<wmx:SqlDataSourceControl id="SqlDataSourceControl1" runat="server" DeleteCommand="" ConnectionString="server='(local)'; trusted_connection=true; database='Northwind'" SelectCommand="SELECT * FROM [Employees]" UpdateCommand=""></wmx:SqlDataSourceControl>
<wmx:MxDataGrid id="MxDataGrid1" runat="server" OnLoad="MxDataGrid1_Load" DataSource="<%# SqlDataSourceControl1 %>" BorderStyle="None" BorderWidth="1px" DataKeyField="EmployeeID" CellPadding="3" BackColor="White" AllowPaging="True" DataMember="Employees" AllowSorting="True" BorderColor="#CCCCCC" DataSourceControlID="SqlDataSourceControl1">
<PagerStyle horizontalalign="Center" forecolor="#000066" backcolor="White" mode="NumericPages"></PagerStyle>
<FooterStyle forecolor="#000066" backcolor="White"></FooterStyle>
<SelectedItemStyle font-bold="True" forecolor="White" backcolor="#669999"></SelectedItemStyle>
<ItemStyle forecolor="#000066"></ItemStyle>
<HeaderStyle font-bold="True" forecolor="White" backcolor="#006699"></HeaderStyle>
</wmx:MxDataGrid>
<!-- Insert content here -->
</form>
</body>
</html>

What error are you getting? Do you get the same error when using a DataGrid?|||i'm getting the following error message:

**********************************************
Server Error in '/' Application.
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".

<!-- Web.Config Configuration File --
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.

<!-- Web.Config Configuration File --
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
****************************************

the sql server path is not in the same folder as the default webpage folder. does that matter? and how do i change the sql server path.|||and is there good textbook that cover ASP.NET using MS WebMatrix?|||This is a good, free online book:Inside ASP.NET WebMatrix by Alex Homer and Dave Sussman.

Terri