2011-09-10 1 views

답변

1

이것은 매우 열린 질문입니다. 거기에 당신이 이것을 달성하는 데 도움이됩니다 자습서가 많이 있습니다. 그것은 당신이 원하는 방식에 따라 다르지만, MVC는 현재 진행하는 좋은 방법입니다.

here을 살펴보고 here 튜토리얼을 살펴보십시오. 두어 시간이 끝날 때까지 기다릴 수 있습니다.

MVC를 사용하지 않으려면 여기에 다시 게시하여 사용하려는 기술을 더 명확하게 알려주고 누군가가 도움을 줄 수 있도록하시기 바랍니다.

0
  1. 이러한 텍스트 필드의 값을 사용합니다. 당신이를 구현하는 방법을 알고 싶다면
  2. 그럼 당신은 (..... textBox1.Text)

을 값을 INSERT INTO TABLE1 (COLUMN1, COLUMN2, COLUMN3 ...) 같은 INSERT 문을 쓰기 전체 데이터베이스 일은 다음 여기에 있습니다 :

Using System.Data.SqlClient; 
...... 

    SqlConnection con=new SqlConnection("Data Source=.";Initial 
    Catalog=Northwind;userID=sa;password=123456); 
    SqlCommand cmd=new SqlCommand(); 
    cmd.connection=con; 
    cmd.commandText="INSERT INTO TABLE1 (C1,C2,C3) VALUES (:V1,:V2,V3)"; 
    cmd.Parameters.Add("V1",SqlDBType.Nvarchar).value=textBox1.Text; 
    /*and so on with the next two parameters. If your parameter's type is different 
    you can change NVarchar to other SQL datatypes available from the drop down list 
    and off course you'll have to convert the textBox's value to the appropriate 
    datatype.*/ 
    cmd.ExecuteNonQuery(); 

이것은 기본적으로 필요한 것입니다.

0

using System.Data.SqlClient;

SqlConnection con = new SqlConnection ("Data Source = .....");

SqlCommand cmd = 새 SqlCommand ("INSERT INTO TableName (StudentId, StudentName, StudentCity) VALUES (@ StudentId, @ StudentName, @ StudentCity)", con);

cmd.Parameters.AddWithValue ("@ StudentId", TextBox1.Text);

cmd.Parameters.AddWithValue ("@ StudentName", TextBox2.Text);

cmd.Parameters.AddWithValue ("@ StudentCity", TextBox3.Text);

cmd.ExecuteNonQuery();

con.Close();

관련 문제