using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
SqlConnection con = new SqlConnection(@"Data Source=.\sqlexpress;Initial Catalog=Registration;Integrated Security=True");
SqlCommand cmd;
SqlDataReader dr;
DataTable dt = new DataTable();
private void btnexecute_Click(object sender, EventArgs e)
{
con.Open();
cmd = new SqlCommand(richTextBox1.Text, con);
dr = cmd.ExecuteReader();
dt.Load(dr);
dataGrid1.DataSource = dt;
cmd = new SqlCommand("sp_helpdb", con);
dr = cmd.ExecuteReader();
while (dr.Read())
{
treeView1.Nodes.Add(dr["name"].ToString());
}
dr.Close();
cmd = new SqlCommand("sp_helpdb", con);
dr = cmd.ExecuteReader();
while (dr.Read())
{
cboDb.Items.Add(dr["name"].ToString());
}
dr.Close();
}
private void newToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
openFileDialog1.Filter="Text File(*.txt)|*.txt";
string filename;
if(openFileDialog1.ShowDialog()==DialogResult.OK);
{
filename=openFileDialog1.FileName;
richTextBox1.LoadFile(openFileDialog1.FileName);
}
}
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
{
saveFileDialog1.Filter = "Text File(*.txt)|*.txt";
saveFileDialog1.DefaultExt = "*.txt";
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
richTextBox1.SaveFile(saveFileDialog1.FileName);
richTextBox1.Clear();
}
}
private void richTextBox1_TextChanged(object sender, EventArgs e)
{
}
private void cboDb_SelectedIndexChanged(object sender, EventArgs e)
{
cmd = new SqlCommand("use"+cboDb.Text,con);
dr = cmd.ExecuteReader();
dr.Close();
}
}
}
ASP.NET is a development framework for building web pages and web sites with HTML, CSS, JavaScript and server scripting. ASP.NET supports three different development models: Web Pages, MVC (Model View Controller), and Web Forms.
Sunday, March 9, 2008
Creating Management Studio using asp.net
add this value and key in web.config
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifpDOBKOcvWKT2iLgs36alkCuyG_o9aLxiR2Bb11S205N719VVE_1FTocFP1nANhmcA4f_QePEJnpusnyt2orROKzZAJx4u3bwqXm_Psna_j_NgJgVJkO1tuSPh9dALBzaUaM1kfuV5hyt/s320/appSettings.jpg)
some sql statements:
sp_helpdb
SELECT * FROM sysobjects and sp_help
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgb-F2vwCEAfjsxibBnU_Obmlwr56dp8BrIsrT9-N2eRo_5m95lBM2Y7x7xvpOXEb2dz-YkoOMIaviTiJusn3_1len_V7Lb-ODrn8v64KKVVkZ2_noL1qF_zJcriDaaqFEdY6bzReZZDaed/s320/mng.JPG)
Html Coding for this:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6zFHok9oY9blZgSIP06JGQIfr1RXEMBhwBIKsFABGOP7vr5bLxCP8__S7j74My6X7oQ0VKuk6YYTpQpm4YU2YmorUBJKgC7x0ggXjxMjAtYm4PqVoECJoin6dULenPGiFfzIg8aDMvI4N/s320/wizard.JPG)
using System.Data.SqlClient;
public partial class Default2 : System.Web.UI.Page
{
SqlCommand cmd;
SqlDataAdapter da;
DataSet ds=new DataSet();
SqlConnection cnn;
SqlDataReader dr;
String strDB;
protected void Page_Load(object sender, EventArgs e)
{
cnn = new SqlConnection(ConfigurationManager.AppSettings.Get("Cnn"));
cnn.Open();
da = new SqlDataAdapter("sp_helpdb", cnn);
da.Fill(ds, "Cat");
if (!IsPostBack)
{
ddlDb.DataSource = ds.Tables["Cat"];
ddlDb.DataTextField = "name";
DataBind();
}
}
protected void Wizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e)
{
}
protected void ddlDb_SelectedIndexChanged(object sender, EventArgs e)
{
strDB = ddlDb.SelectedItem.ToString();
cnn = new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog='"+strDB+"';Integrated Security=True");
da = new SqlDataAdapter("SELECT * FROM sysobjects WHERE xtype = 'u'", cnn);
da.Fill(ds, "student");
ddlTable.DataSource = ds.Tables["student"];
ddlTable.DataTextField = "name";
DataBind();
}
protected void ddlTable_SelectedIndexChanged(object sender, EventArgs e)
{
strDB = ddlDb.SelectedItem.ToString();
cnn = new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog='" + strDB + "';Integrated Security=True");
cnn.Open();
cmd = new SqlCommand("sp_help " + ddlTable.SelectedItem.ToString(), cnn);
dr = cmd.ExecuteReader();
dr.NextResult();
while (dr.Read())
lstFields.Items.Add(dr["column_name"].ToString());
}
protected void btnExecute_Click(object sender, EventArgs e)
{
strDB = ddlDb.SelectedItem.ToString();
cnn = new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog='" + strDB + "';Integrated Security=True");
cnn.Open();
{
SqlCommand smd = new SqlCommand(TextBox1.Text, cnn);
dr = smd.ExecuteReader();
{
DataTable dt = new DataTable();
dt.Load(dr);
DataGrid1.DataSource = dt;
DataGrid1.DataBind();
}
}
}
}
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifpDOBKOcvWKT2iLgs36alkCuyG_o9aLxiR2Bb11S205N719VVE_1FTocFP1nANhmcA4f_QePEJnpusnyt2orROKzZAJx4u3bwqXm_Psna_j_NgJgVJkO1tuSPh9dALBzaUaM1kfuV5hyt/s320/appSettings.jpg)
some sql statements:
sp_helpdb
SELECT * FROM sysobjects and sp_help
Html Coding for this:
using System.Data.SqlClient;
public partial class Default2 : System.Web.UI.Page
{
SqlCommand cmd;
SqlDataAdapter da;
DataSet ds=new DataSet();
SqlConnection cnn;
SqlDataReader dr;
String strDB;
protected void Page_Load(object sender, EventArgs e)
{
cnn = new SqlConnection(ConfigurationManager.AppSettings.Get("Cnn"));
cnn.Open();
da = new SqlDataAdapter("sp_helpdb", cnn);
da.Fill(ds, "Cat");
if (!IsPostBack)
{
ddlDb.DataSource = ds.Tables["Cat"];
ddlDb.DataTextField = "name";
DataBind();
}
}
protected void Wizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e)
{
}
protected void ddlDb_SelectedIndexChanged(object sender, EventArgs e)
{
strDB = ddlDb.SelectedItem.ToString();
cnn = new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog='"+strDB+"';Integrated Security=True");
da = new SqlDataAdapter("SELECT * FROM sysobjects WHERE xtype = 'u'", cnn);
da.Fill(ds, "student");
ddlTable.DataSource = ds.Tables["student"];
ddlTable.DataTextField = "name";
DataBind();
}
protected void ddlTable_SelectedIndexChanged(object sender, EventArgs e)
{
strDB = ddlDb.SelectedItem.ToString();
cnn = new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog='" + strDB + "';Integrated Security=True");
cnn.Open();
cmd = new SqlCommand("sp_help " + ddlTable.SelectedItem.ToString(), cnn);
dr = cmd.ExecuteReader();
dr.NextResult();
while (dr.Read())
lstFields.Items.Add(dr["column_name"].ToString());
}
protected void btnExecute_Click(object sender, EventArgs e)
{
strDB = ddlDb.SelectedItem.ToString();
cnn = new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog='" + strDB + "';Integrated Security=True");
cnn.Open();
{
SqlCommand smd = new SqlCommand(TextBox1.Text, cnn);
dr = smd.ExecuteReader();
{
DataTable dt = new DataTable();
dt.Load(dr);
DataGrid1.DataSource = dt;
DataGrid1.DataBind();
}
}
}
}
Subscribe to:
Posts (Atom)
Using Authorization with Swagger in ASP.NET Core
Create Solution like below LoginModel.cs using System.ComponentModel.DataAnnotations; namespace UsingAuthorizationWithSwagger.Models { ...
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigYvnrLEzt4ShwHspgLFcKca1ugKiAJefHhn0x-ZcdjxlEBpid_Lf_1tqK6B357aqEWc0kn_iscjmzgCyKPWoTq6u6t7AoHU93lR6TPNnUDnXe-CyxhevRWGrFu2DUInbfdWV3ocUfbMQsDTH3cAp4HGSrVikwC9OeHkIh4dMOzqOESQ4jYE-w3Av8gA/s16000/1.jpg)
-
Output: using Microsoft.VisualBasic; using System; using System.Collections; using System.Collections.Generic; using S...
-
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.D...
-
<ControlTemplate x:Key="TextBoxBaseControlTemplate" TargetType="{x:Type TextBoxBase}"> <Borde...