Author |
Topic |
earlmoore
Starting Member
6 Posts |
Posted - 2007-04-09 : 06:31:46
|
Hi I am trying to create a table via an asp.net 2 page.... but having a little difficultyMy background is php but my employers do not support php. therefore i have had to start learning ASP.NETI have a database etc. and what i needI am using Visual Web Developer which is on my personal laptop, (again my employers do not support it) other wise i would have installed in on my work pc.Basically I cannot create or do not know how to create a table in an ASP.NET page. have scanned a few books and googled it but no joyCan anyone helpMany thanks in advanceTunes...Make you dance more easily |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-04-09 : 06:46:20
|
Either you can use Table control from HTML tab in toolbox or you can do it manually using <TABLE> tag (I assume you mean HTML table here)Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
|
|
earlmoore
Starting Member
6 Posts |
Posted - 2007-04-09 : 07:07:04
|
No not the html side, the database table.have a database, and want to create a table in it but am completely lostTunes...Make you dance more easily |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-04-09 : 07:15:39
|
I don't think that is proper way of creating table but you can do it by executing CREATE TABLE command through SqlCommand object.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
|
|
earlmoore
Starting Member
6 Posts |
Posted - 2007-04-09 : 07:24:15
|
I have tried this<body> <form id="form1" runat="server"> <div> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ebm_ConnectionString %>" SelectCommand="SELECT * FROM [test_table]"> </asp:SqlDataSource> </div> </form></body> Tunes...Make you dance more easily |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-04-09 : 07:35:45
|
I am not sure what you want exactly? Is [test_table] already created in the database or you want to create it?Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
|
|
earlmoore
Starting Member
6 Posts |
Posted - 2007-04-09 : 07:39:25
|
Duh Sorryme being stupid<body> <form id="form1" runat="server"> <div> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ebm_ConnectionString %>" SelectCommand="CREATE TABLE test_table ( test1 INT PRIMARY KEY, test2 VARCHAR() NOT NULL)"> </asp:SqlDataSource> </div> </form></body>Tunes...Make you dance more easily |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2007-04-09 : 10:13:04
|
Your application should just about NEVER be creating tables in your database. Why are you trying to do this? What is your goal? It is usually a horrible, horrible idea to have your application code dynamically create and tables and indicates a bad database design (or none at all)... tables and their columns and relations should be CONSTANTS that you design once, not dynamic and changing.- Jeffhttp://weblogs.sqlteam.com/JeffS |
|
|
earlmoore
Starting Member
6 Posts |
Posted - 2007-04-09 : 10:33:41
|
I just want a table in my databaseAt the moment there isnt one.I cannot create one via a webtool, so i assume the only other way is to create one with a ASP.NET page and sqlTunes...Make you dance more easily |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-04-09 : 10:50:36
|
or at the very least, you can use sqlcmd tool if you are working with SQL Express.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
|
|
earlmoore
Starting Member
6 Posts |
Posted - 2007-04-09 : 17:35:09
|
thats excellent!many many many thanksjust goes to show how new i amagain many thanks it workedTunes...Make you dance more easily |
|
|
|