Click here to Skip to main content
15,892,927 members
Home / Discussions / C#
   

C#

 
Questioninserting data Pin
sandy_r26-Aug-08 20:39
sandy_r26-Aug-08 20:39 
AnswerRe: inserting data Pin
M. K. BASHER26-Aug-08 20:45
M. K. BASHER26-Aug-08 20:45 
AnswerRe: inserting data Pin
N a v a n e e t h26-Aug-08 20:48
N a v a n e e t h26-Aug-08 20:48 
GeneralRe: inserting data Pin
sandy_r27-Aug-08 18:22
sandy_r27-Aug-08 18:22 
GeneralRe: inserting data Pin
varun_mca_ju26-Aug-08 21:17
varun_mca_ju26-Aug-08 21:17 
GeneralRe: inserting data Pin
sandy_r27-Aug-08 18:21
sandy_r27-Aug-08 18:21 
GeneralRe: inserting data Pin
Ahsan22527-Aug-08 20:08
Ahsan22527-Aug-08 20:08 
AnswerRe: inserting data Pin
varun_mca_ju27-Aug-08 20:13
varun_mca_ju27-Aug-08 20:13 
using System.Data.SqlClient;
using System.Data.OleDb;


code for connecting to SQL database:-

try
{

SqlConnection mc = new SqlConnection(Persist Security Info=False;User ID=sa;Initial Catalog=DataBase_Name;Data Source= SQL_Server_Name");
SqlDataAdapter da =new SqlDataAdapter("Select * from Table_name", mc);
DataSet ds =new DataSet();
da.Fill(ds,"Table_name");
MessageBox.Show("Connection Successfull");
}
catch(Exception ex)
{MessageBox.Show(ex.Message);
}

code for inserting data from textBox:-
try{
SqlCommand insertCmd=new SqlCommand("insert into Table_Name(Column_Name)values(@Variable_name)",Connection_Name);
insertCmd.Parameters.Add("@Variable_Name",SqlDbType.Nchar,10);
insertCmd.Parameters["@Variable_Name"].Value=textBox1.Text;
insertCmd.ExecuteNonQuery();
MessageBox.Show("Records inserted successfully");
}
catch(Exception ex)
{MessageBox.Show(ex.Message);}
Questionmake only a rectangle of a form transulent Pin
softwarejaeger26-Aug-08 20:38
softwarejaeger26-Aug-08 20:38 
AnswerRe: make only a rectangle of a form transulent Pin
noah7426-Aug-08 23:14
noah7426-Aug-08 23:14 
Questionincrementing using C#.Net Pin
varun_mca_ju26-Aug-08 20:19
varun_mca_ju26-Aug-08 20:19 
AnswerRe: incrementing using C#.Net Pin
C1AllenS26-Aug-08 20:32
C1AllenS26-Aug-08 20:32 
General[Message Deleted] Pin
varun_mca_ju26-Aug-08 20:48
varun_mca_ju26-Aug-08 20:48 
QuestionRe: incrementing using C#.Net Pin
varun_mca_ju26-Aug-08 21:05
varun_mca_ju26-Aug-08 21:05 
GeneralRe: incrementing using C#.Net Pin
Ashfield26-Aug-08 21:06
Ashfield26-Aug-08 21:06 
QuestionRe: incrementing using C#.Net Pin
varun_mca_ju26-Aug-08 21:23
varun_mca_ju26-Aug-08 21:23 
AnswerRe: incrementing using C#.Net Pin
Ashfield26-Aug-08 21:45
Ashfield26-Aug-08 21:45 
QuestionRe: incrementing using C#.Net Pin
varun_mca_ju26-Aug-08 22:10
varun_mca_ju26-Aug-08 22:10 
AnswerRe: incrementing using C#.Net Pin
Ashfield27-Aug-08 0:30
Ashfield27-Aug-08 0:30 
QuestionAdd controls to a tab page at run-time Pin
CodingLover26-Aug-08 19:25
CodingLover26-Aug-08 19:25 
AnswerRe: Add controls to a tab page at run-time Pin
michael@cohen26-Aug-08 19:32
michael@cohen26-Aug-08 19:32 
QuestionRe: Add controls to a tab page at run-time Pin
CodingLover26-Aug-08 19:53
CodingLover26-Aug-08 19:53 
AnswerRe: Add controls to a tab page at run-time Pin
Mycroft Holmes26-Aug-08 22:07
professionalMycroft Holmes26-Aug-08 22:07 
GeneralRe: Add controls to a tab page at run-time Pin
CodingLover26-Aug-08 22:43
CodingLover26-Aug-08 22:43 
GeneralRe: Add controls to a tab page at run-time Pin
Mycroft Holmes26-Aug-08 22:54
professionalMycroft Holmes26-Aug-08 22:54 

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.