Click here to Skip to main content
15,925,042 members
Home / Discussions / Database
   

Database

 
GeneralRe: Connection Via DSN in VB.Net Pin
Andy Brummer6-Sep-05 12:18
sitebuilderAndy Brummer6-Sep-05 12:18 
GeneralRe: Connection Via DSN in VB.Net Pin
Anonymous7-Sep-05 3:23
Anonymous7-Sep-05 3:23 
QuestionPlease help me,,(MySql Front Installation) Pin
Jeeva Mary Varghese4-Sep-05 18:38
Jeeva Mary Varghese4-Sep-05 18:38 
QuestionUser And Password with ... Pin
mostafa_h4-Sep-05 8:58
mostafa_h4-Sep-05 8:58 
AnswerRe: User And Password with ... Pin
Colin Angus Mackay4-Sep-05 9:50
Colin Angus Mackay4-Sep-05 9:50 
QuestionUser And Password Pin
mostafa_h4-Sep-05 2:57
mostafa_h4-Sep-05 2:57 
AnswerRe: User And Password Pin
Colin Angus Mackay4-Sep-05 4:48
Colin Angus Mackay4-Sep-05 4:48 
Questionhow do i access a column from database Pin
ashima143-Sep-05 20:22
ashima143-Sep-05 20:22 
AnswerRe: how do i access a column from database Pin
Colin Angus Mackay3-Sep-05 21:31
Colin Angus Mackay3-Sep-05 21:31 
QuestionUpdate DataSet Pin
Zeeshan Gulzar3-Sep-05 4:15
Zeeshan Gulzar3-Sep-05 4:15 
AnswerRe: Update DataSet Pin
Besinci4-Sep-05 9:38
Besinci4-Sep-05 9:38 
GeneralRe: Update DataSet Pin
Zeeshan Gulzar6-Sep-05 5:51
Zeeshan Gulzar6-Sep-05 5:51 
QuestionVB and remote database(web) Pin
aluizs2-Sep-05 18:03
aluizs2-Sep-05 18:03 
Questioninset a Datacolumn Pin
PaulaM2-Sep-05 3:23
PaulaM2-Sep-05 3:23 
AnswerRe: inset a Datacolumn Pin
Besinci2-Sep-05 9:37
Besinci2-Sep-05 9:37 
Questionupdating the DB Pin
minkinin2-Sep-05 3:16
minkinin2-Sep-05 3:16 
AnswerRe: updating the DB Pin
Besinci2-Sep-05 10:04
Besinci2-Sep-05 10:04 
GeneralRe: updating the DB Pin
minkinin4-Sep-05 20:20
minkinin4-Sep-05 20:20 
GeneralRe: updating the DB Pin
Besinci4-Sep-05 21:24
Besinci4-Sep-05 21:24 
GeneralRe: updating the DB Pin
minkinin4-Sep-05 22:27
minkinin4-Sep-05 22:27 
GeneralRe: updating the DB Pin
Besinci5-Sep-05 7:49
Besinci5-Sep-05 7:49 
Here you go Smile | :) this will do it..


using System;

namespace Tester
{
///
/// Summary description for Class2.
///

public class Class1
{

public Class1()
{

}

public void GenerateColumns(System.Data.SqlClient.SqlConnection connection)
{
string selectstr = "SELECT name FROM sysobjects WHERE xtype ='U' AND name <> 'dtproperties' ORDER BY name";//select only user tables
System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand(selectstr, connection);
cmd.Connection = connection;

cmd.Connection.Open();
System.Data.SqlClient.SqlDataReader dr = cmd.ExecuteReader();
while(dr.Read())
{
this.AddColumn(dr.GetString(0), cmd.Connection.ConnectionString);
}
cmd.Connection.Close();
}

private void AddColumn(string tableName, string connnectionStr)
{
//ALTER TABLE table ADD column VARCHAR(20) NULL
string alterTableStr = string.Format("ALTER TABLE {0} ADD {1} {2} {3}", tableName, "YourColumnName", "datetime Default getdate()", "NULL");
System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand(alterTableStr, new System.Data.SqlClient.SqlConnection(connnectionStr));
try
{
cmd.Connection.Open();
cmd.ExecuteNonQuery();
}
catch(System.Exception e)
{
System.Windows.Forms.MessageBox.Show(e.Message);
}
finally
{
cmd.Connection.Close();
}
}
}
}






-- modified at 14:02 Monday 5th September, 2005
GeneralRe: updating the DB Pin
minkinin6-Sep-05 23:38
minkinin6-Sep-05 23:38 
QuestionI need to load custom data to Analysis Server (MS-OLAP) without going through any OLE DB Provider. Pin
kuldeepjangir2-Sep-05 3:13
kuldeepjangir2-Sep-05 3:13 
QuestionSqlDataAdapter question.. What.... Pin
Besinci2-Sep-05 2:40
Besinci2-Sep-05 2:40 
AnswerRe: SqlDataAdapter question.. What.... Pin
Luis Alonso Ramos2-Sep-05 17:26
Luis Alonso Ramos2-Sep-05 17:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.