title: Importing .DAT file to Database?
body: <p>How would I go about import/inserting a .DAT file into the database by calling a procedure?</p>
  
  <p>Here's what my file would look like and it has to go into the database in this format.</p>
  
  <pre><code>50  4411902304  1   3   441192304   01/02/2013    
  </code></pre>
  
  <p>Would the process be the same for .DAT file as to xml file?</p>
  
  <p>Here's what I have for xml</p>
  
  <pre><code>            SqlConnection myConnection = new SqlConnection("user id=name;" +
                                     "password=password;server=servername;" +
                                     "Trusted_Connection=yes;" +
                                     "database=database; " +
                                     "connection timeout=30");
  
          var conn = new SqlConnection();
          conn.ConnectionString = "user id=idName;" +
                                     "password=password;" + "server=servername;" + "Trusted_Connection=yes;" + "database=databasename; " +  "connection timeout=30";
  
  
          string filePath = "C:/TestData2.xml";
          string xml = File.ReadAllText(filePath);
          using (SqlConnection con = new SqlConnection(conn.ConnectionString))
          {
              using (SqlCommand cmd = new SqlCommand("procedureName"))
              {
                  cmd.Connection = con;
                  cmd.CommandType = CommandType.StoredProcedure;
                  cmd.Parameters.AddWithValue("@x", xml);
                  con.Open();
                  cmd.ExecuteNonQuery();
                  con.Close();
                  MessageBox.Show("done");
              }
          }
  </code></pre>