static void Main(string[] args) { //SqlServerProcMetaReader proc = new SqlServerProcMetaReader("Data Source=localhost;Initial Catalog=Sipmch3;Persist Security Info=True;User ID=sa;Password=sa;"); //var a = proc.SpResultMeta; SqlServerTableMetaReader reader = new SqlServerTableMetaReader("Data Source=localhost;Initial Catalog=Sipmch3;Persist Security Info=True;User ID=sa;Password=sa;"); //reader.RetriveTableDetails(reader.GetTables("dbo").Select(x => x.Name).ToList()); }
private void Main_Load(object sender, EventArgs e) { InitialTemplateInfo(); InitialSettingInfo(); if (TestConnection()) { procMetaReader = new SqlServerProcMetaReader(txtCon.Text); tableMetaReader = new SqlServerTableMetaReader(txtCon.Text); InitialGvProcedures(); tables = tableMetaReader.GetTables("dbo"); InitialGvTables(tables); InitialGvViews(tables); } }
private void InitailTables() { List<string> selectFiles = RetriveGridViewSelect(gvTemplate, "FullPath", "ColCheck"); int i = 0; for (i = 0; i < selectFiles.Count; i++) { if (Path.GetFileName(selectFiles[i]) != "CSProj.Solution.tt") break; } if (i == selectFiles.Count) return; OnShowWorkInfoEventHandler(this, new WorkEventArgs(WorkStage.InitializeWork, "Initialize Tables..")); SqlServerTableMetaReader tableReader = new SqlServerTableMetaReader(T4Parameters.Default.SqlConnectionString); T4Parameters.Default.Tables = tableReader.RetriveTableDetails(); //table no primary key and view no keyID List<string> errorTables = new List<string>(); List<string> errorViews = new List<string>(); for (int j = 0; j < T4Parameters.Default.Tables.Count; j++) { if (T4Parameters.Default.Tables[j].TableType== T4Common.Domain.EnumTableType.Table && T4Parameters.Default.Tables[j].PrimaryKey.Columns.Count == 0) errorTables.Add(T4Parameters.Default.Tables[j].Name); else if((T4Parameters.Default.Tables[j].TableType== T4Common.Domain.EnumTableType.View && T4Parameters.Default.Tables[j].Columns.Count(x=>x.Name.Equals("KeyID", StringComparison.OrdinalIgnoreCase)) == 0)) errorViews.Add(T4Parameters.Default.Tables[j].Name); } SetTableErrorlog(errorTables, EnumTableType.Table); SetTableErrorlog(errorViews, EnumTableType.View); }
private void BtnCon_Click(object sender, EventArgs e) { if (TestConnection()) { MessageBox.Show("Successful connection!","Connection information"); procMetaReader = new SqlServerProcMetaReader(txtCon.Text); tableMetaReader = new SqlServerTableMetaReader(txtCon.Text); tables = tableMetaReader.GetTables("dbo"); InitialGvProcedures(); InitialGvTables(tables); InitialGvViews(tables); } else MessageBox.Show("Connection failed!"); }