i want 2 pass values(enterd in textbox)to table in sql
server without using stored procedure in c#.plz tell me
code with an example.
Answer Posted / bala
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 WindowsFormsApplication4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs
e)
{
String ConnectionString = "Data
Source=ServerName;Initial Catalog=DatabaseName;Integrated
Security=true";
String Query = "insert into tablename values('"
+ textBox1.Text + "')";
SqlConnection Con = new SqlConnection
(ConnectionString) ;
Con.Open();
SqlCommand Cmd = new SqlCommand(Query, Con);
Cmd.ExecuteNonQuery();
Cmd.Dispose();
Con.Close();
}
}
}
| Is This Answer Correct ? | 10 Yes | 2 No |
Post New Answer View All Answers
What are the advantages using ado.net?
What are the advantages of using datalist?
How to Read, Add, Update and Delete record in Entity Framework ?
What is the difference between connected and disconnected environment?
What is ole in excel?
What is linq and entity framework?
Which database is the ado.net sql connection object designed for?
differance between ADO vs ADO.Net?
Explain the namespaces in which .net has the data functionality class.
Is ado.net an orm?
How do you connect to sql server database without using sqlclient?
What are all the different methods under sqlcommand?
What is the use of Dataview?
How can you add or remove rows from the datatable object of dataset?
What are the difference between readonly vs. Const?