<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4157804888186498733</id><updated>2024-09-14T06:14:23.927-07:00</updated><title type='text'>Programming (C#,Java, javascript, Objective-C, C, C++) for everyone.</title><subtitle type='html'>Ну что сказать. Блог программиста и для программистов. Рассматриваемые темы от того как записать в int null и до рефакторинга всех вещей, которыми обычно программист не забивает себе голову во время написания приложения.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://programmingwithnoproblem.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157804888186498733/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://programmingwithnoproblem.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05832334570814992067</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>17</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4157804888186498733.post-9109539802426994085</id><published>2012-10-18T00:59:00.002-07:00</published><updated>2012-10-18T01:00:06.638-07:00</updated><title type='text'>NEW DbfFieldType USING EVAL </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Linq;&lt;br /&gt;
using System.Text;&lt;br /&gt;
using WhitePage.Data;&lt;br /&gt;
namespace TestDbfRecord&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; class Program&lt;br /&gt;
&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; static void Main(string[] args)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //NEW DbfFieldType&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //USING&amp;nbsp; EVAL &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //create table &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; List&amp;lt;DbfFieldInfo&amp;gt; fields = new List&amp;lt;DbfFieldInfo&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fields.Add( new DbfFieldInfo(&quot;nickname&quot;, DbfFieldType.Character ,100 ));&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fields.Add( new DbfFieldInfo(&quot;note&quot;, DbfFieldType.Memo, 0));&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fields.Add(new DbfFieldInfo(&quot;DT&quot;, &#39;D&#39;, 8, 0));&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fields.Add(new DbfFieldInfo(&quot;NUM&quot;, &#39;N&#39;, 6, 2));&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fields.Add(new DbfFieldInfo(&quot;LOGI&quot;, &#39;L&#39;, 1, 0));&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DbfFieldInfo field = new DbfFieldInfo();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; field = new DbfFieldInfo();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; field.Name = &quot;note&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; field.Type = DbfFieldType.Memo;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fields.Add(field);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string file = AppDomain.CurrentDomain.BaseDirectory +&quot;&lt;a href=&quot;file://demo.dbf/&quot;&gt;\\demo.dbf&lt;/a&gt;&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; using (DbfRecordset rs = DbfRecordset.Create(file, fields))&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;iif(1+1 &amp;gt; 2 , .T. , .F.)&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;.t. and .t.&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;.t. .and. .t.&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;.t. .or. .F.&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;-1&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;--1&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;---1&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;----1 + -2&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;! .t. &quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;not .t. &quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;.not. .t. &quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;&#39;abc&#39; == &#39;abc&#39;&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;&#39;abc&#39; == &#39;ab&#39;&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;&#39;abc&#39; &amp;gt; &#39;ab&#39;&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot; 200.92 &amp;gt;= 1000.23433&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot; 200.92 != 1000.23433&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot; &#39;nick&#39; $ &#39;i&#39;&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot; &#39;i&#39; $ &#39;nick&#39;&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;UPPER(&#39;qwerty&#39;)&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;str(100.23) + str(12.34)&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;&#39;[&#39; + str(12.344, 10) + &#39;]&#39;&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;&#39;[&#39; + str(12.344, 10,2) + &#39;]&#39;&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;right(&#39;1234567&#39;,3)&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;left(&#39;1234567&#39;,3)&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;QUARTER(CTOD(&#39;11/12/2012&#39;),1)&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;day(CTOD(&#39;11/12/2012&#39;))&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;month(CTOD(&#39;11/12/2012&#39;))&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;CTOD(&#39;11/12/2012&#39;)&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;STOD(&#39;20120131&#39;)&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;empty(&#39;20120131&#39;)&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;empty(&#39;&#39;)&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;trim(&#39; rwytuwyrt&amp;nbsp;&amp;nbsp; &#39;)&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;ltrim(&#39; rwytuwyrt&amp;nbsp;&amp;nbsp; &#39;)&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;alltrim(&#39; rwytuwyrt&amp;nbsp;&amp;nbsp; &#39;)&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;&#39;[&#39; + padR(&#39;123&#39;,10) + &#39;]&#39;&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;&#39;[&#39; + padR(&#39;123&#39;,10,&#39;W&#39;) + &#39;]&#39;&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;&#39;[&#39; + padL(&#39;123&#39;,10) + &#39;]&#39;&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;&#39;[&#39; + padL(&#39;123&#39;,10,&#39;W&#39;) + &#39;]&#39;&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;soundex(&#39;word&#39;)&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;len(&#39;word&#39;)&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;val(&#39;12.34&#39;)&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(rs, &quot;abs(-12.34)&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Random ran = new Random(1000);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int recCount = 10;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i = 1; i &amp;lt;= recCount; i++)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int id = ran.Next(0,1000);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string nick = &quot;Jon ID :&quot; +&amp;nbsp; id.ToString();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Diagnostics.Debug.Print(nick);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rs.AddNew(); // append black&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rs[&quot;nickname&quot;] = nick;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rs.Update(); // commit changes&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rs.ForEach(r =&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval(r, &quot;substr(nickname,2,2) + upper(nickname)&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return false; // only once&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rs.Close();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; static void eval(DbfRecordset rs, string expr)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; object value = rs.Eval(expr);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Diagnostics.Debug.Print( expr + &quot; : &quot; + value.ToString()&amp;nbsp; );&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp; }&lt;br /&gt;
}&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://programmingwithnoproblem.blogspot.com/feeds/9109539802426994085/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://programmingwithnoproblem.blogspot.com/2012/10/new-dbffieldtype-using-eval.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157804888186498733/posts/default/9109539802426994085'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157804888186498733/posts/default/9109539802426994085'/><link rel='alternate' type='text/html' href='http://programmingwithnoproblem.blogspot.com/2012/10/new-dbffieldtype-using-eval.html' title='NEW DbfFieldType USING EVAL '/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05832334570814992067</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157804888186498733.post-8979652672506453652</id><published>2012-10-17T01:00:00.002-07:00</published><updated>2012-10-17T01:00:33.670-07:00</updated><title type='text'>USING  MEMO (DBT) and ForEach</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
using System;&lt;br /&gt;using System.Collections.Generic;&lt;br /&gt;using System.Linq;&lt;br /&gt;using System.Text;&lt;br /&gt;using WhitePage.Data;&lt;br /&gt;
&lt;br /&gt;
namespace TestDbfRecord&lt;br /&gt;{&lt;br /&gt;&amp;nbsp; class Program&lt;br /&gt;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; static void Main(string[] args)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //USING&amp;nbsp; MEMO (DBT) and ForEach&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //create table &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; List&amp;lt;DbFieldInfo&amp;gt; fields = new List&amp;lt;DbFieldInfo&amp;gt;();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DbFieldInfo field = new DbFieldInfo();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; field.Name = &quot;nickname&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; field.Type = &#39;C&#39;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; field.Len = 100;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fields.Add(field);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; field = new DbFieldInfo();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; field.Name = &quot;note&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; field.Type = &#39;M&#39;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fields.Add(field);&lt;br /&gt;
&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string file = AppDomain.CurrentDomain.BaseDirectory +&quot;&lt;a href=&quot;file://demo.dbf/&quot;&gt;\\demo.dbf&lt;/a&gt;&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; using (DbfRecordset rs = DbfRecordset.Create(file, fields))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Random ran = new Random(1000);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int recCount = 10;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i = 1; i &amp;lt;= recCount; i++)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int id = ran.Next(0,1000);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string nick = &quot;Jon ID :&quot; +&amp;nbsp; id.ToString();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Diagnostics.Debug.Print(nick);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rs.AddNew(); // append black&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rs[&quot;nickname&quot;] = nick;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rs[&quot;note&quot;] = @&quot;&lt;br /&gt;fsog[apiofsdug[ opiug oiuergpo&lt;br /&gt;e prioue[u[etguo[ieutg[oitroieutoi ogjdf;lkjg;lkdsf&lt;br /&gt;dsopfgih[posdi h[podigh[psodgih&lt;br /&gt;sdgoih[posdgihpo&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rs.Update(); // commit changes&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rs.ForEach(r =&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Diagnostics.Debug.Print(rs[&quot;nickname&quot;].ToString());&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Diagnostics.Debug.Print(rs[&quot;note&quot;].ToString());&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return true;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rs.Close();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;}&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://programmingwithnoproblem.blogspot.com/feeds/8979652672506453652/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://programmingwithnoproblem.blogspot.com/2012/10/using-memo-dbt-and-foreach.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157804888186498733/posts/default/8979652672506453652'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157804888186498733/posts/default/8979652672506453652'/><link rel='alternate' type='text/html' href='http://programmingwithnoproblem.blogspot.com/2012/10/using-memo-dbt-and-foreach.html' title='USING  MEMO (DBT) and ForEach'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05832334570814992067</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157804888186498733.post-3217196196084816364</id><published>2012-10-17T00:17:00.003-07:00</published><updated>2012-10-17T00:59:43.571-07:00</updated><title type='text'>First Demo Using Of DBF CDX.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Linq;&lt;br /&gt;
using System.Text;&lt;br /&gt;
using WhitePage.Data;&lt;br /&gt;
namespace TestDbfRecord&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; class Program&lt;br /&gt;
&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; static void Main(string[] args)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //create table &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; List&amp;lt;DbFieldInfo&amp;gt; fields = new List&amp;lt;DbFieldInfo&amp;gt;();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DbFieldInfo field = new DbFieldInfo();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; field.Name = &quot;nickname&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; field.Type = &#39;C&#39;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; field.Len = 100;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fields.Add(field);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; field = new DbFieldInfo();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; field.Name = &quot;dt&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; field.Type = &#39;D&#39;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fields.Add(field);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string file = AppDomain.CurrentDomain.BaseDirectory +&quot;&lt;a href=&quot;file://demo.dbf/&quot;&gt;\\demo.dbf&lt;/a&gt;&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; using (DbfRecordset rs = DbfRecordset.Create(file, fields))&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rs.CreateIndex(&quot;inick&quot;, &quot;nickname&quot;, null);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rs.CreateIndex(&quot;idt&quot;, &quot;dt&quot;, null);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Random ran = new Random(1000);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int recCount = 10;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i = 1; i &amp;lt;= recCount; i++)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int days = ran.Next(0,1000);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string nick = &quot;Jon:&quot; +&amp;nbsp; days.ToString();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Diagnostics.Debug.Print(nick);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rs.AddNew(); // append black&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rs[&quot;nickname&quot;] = nick;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rs[&quot;dt&quot;] = DateTime.Now.AddDays(days);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rs.Update(); // commit changes&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // aplay index tag inick - sorted by nickname&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rs.Index = &quot;inick&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Diagnostics.Debug.Print(&quot;--- sorted by nickname ----&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rs.MoveFirst();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (!rs.Eof)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Diagnostics.Debug.Print(rs[&quot;nickname&quot;].ToString());&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rs.MoveNext();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rs.Index = &quot;idt&quot;; // aplay index tag idt&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Diagnostics.Debug.Print(&quot;--- sorted by nickname ----&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rs.MoveFirst();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (!rs.Eof)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Diagnostics.Debug.Print(rs[&quot;nickname&quot;].ToString() + &quot; &quot; +&amp;nbsp; rs[&quot;dt&quot;].ToString());&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rs.MoveNext();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rs.Close();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp; }&lt;br /&gt;
}&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://programmingwithnoproblem.blogspot.com/feeds/3217196196084816364/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://programmingwithnoproblem.blogspot.com/2012/10/first-demo-using-of-dbf-cdx.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157804888186498733/posts/default/3217196196084816364'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157804888186498733/posts/default/3217196196084816364'/><link rel='alternate' type='text/html' href='http://programmingwithnoproblem.blogspot.com/2012/10/first-demo-using-of-dbf-cdx.html' title='First Demo Using Of DBF CDX.'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05832334570814992067</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157804888186498733.post-5085010834978745426</id><published>2012-10-16T02:38:00.001-07:00</published><updated>2012-10-17T01:11:07.520-07:00</updated><title type='text'>New Life of DBF file format. First article.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Hello to everyone. I developed &quot;dll&quot; to work with dbf file format that allows you to work with dbf files without VFPOLEDB provider and now you dont need to use ODBC driver. This utility is perfectly works at x64 OS. For first 100 customers it will costs just 1$. You can download trial version of the product from site &amp;nbsp;&lt;a href=&quot;http://baybaksoft.ucoz.com/index/0-29&quot;&gt;http://baybaksoft.ucoz.com/index/0-29&lt;/a&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://programmingwithnoproblem.blogspot.com/feeds/5085010834978745426/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://programmingwithnoproblem.blogspot.com/2012/10/new-life-of-dbf-file-format-first.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157804888186498733/posts/default/5085010834978745426'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157804888186498733/posts/default/5085010834978745426'/><link rel='alternate' type='text/html' href='http://programmingwithnoproblem.blogspot.com/2012/10/new-life-of-dbf-file-format-first.html' title='New Life of DBF file format. First article.'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05832334570814992067</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157804888186498733.post-4589062677652200205</id><published>2012-04-03T05:17:00.002-07:00</published><updated>2012-04-03T05:17:44.121-07:00</updated><title type='text'>Migrating from Visual Fox Pro to Sql Server. (Converting dbf to MS Sql Server etc) Second edition. Creating dbf file and editing data.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&amp;nbsp; &amp;nbsp; Here is the example how we can easy create and edit data in our dbf file. &amp;nbsp;This dll was the basis for my &quot;Dbf2Any&quot; programm. Wich can convert dbf files to MS Sql Server, PostgreSql. At this moment at the work converting dbf to Oracle and MySql.&lt;br /&gt;
Here we will be using datagrid in virtual mode.&lt;br /&gt;
I think that this example is clear enough, &amp;nbsp;but if anyone will have questions please write me.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.ComponentModel;&lt;br /&gt;
using System.Data;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Linq;&lt;br /&gt;
using System.Text;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
using &amp;nbsp;DbfCore;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
string[] Fields = new string[] { &quot;Fld1&quot;, &quot;Fld2&quot;, &quot;Fld3&quot;, &quot;Fld4&quot;, &quot;Fld5&quot;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;Fld6&quot;, &quot;Fld7&quot;,&quot;Fld8&quot;, &quot;Fld9&quot;, &quot;Fld10&quot; };&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
List&amp;lt;DbFieldInfo&amp;gt; fieldsList = new List&amp;lt;DbFieldInfo&amp;gt;();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; DbfRecordset _recSet;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; string fileName = Application.StartupPath + &quot;\\test.dbf&quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;private void OpenCreateRecordSet()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; if (System.IO.File.Exists(fileName))&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _recSet = new DbfRecordset(fileName);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (int i = 0; i &amp;lt; _recSet.FieldCount; i++)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.dataGridView1.Columns.Add(_recSet.Fields[i].Name, _recSet.Fields[i].Name + &quot; Type(&quot; + _recSet.Fields[i].Type + &quot;)&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; else&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (int i = 0; i &amp;lt; 10; i++)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DbFieldInfo dbFldInfo = new DbFieldInfo(Fields[i], &#39;C&#39;, 20);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; fieldsList.Add(dbFldInfo);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _recSet = DbfRecordset.Create(fileName, fieldsList);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
private void SetupGrid()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; if (_recSet == null)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; this.dataGridView1.RowCount = _recSet.RecordCount;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; this.dataGridView1.CellValueNeeded += new DataGridViewCellValueEventHandler(dataGridView1_CellValueNeeded); &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; this.dataGridView1.CellValuePushed += new DataGridViewCellValueEventHandler(dataGridView1_CellValuePushed);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; this.dataGridView1.NewRowNeeded += new DataGridViewRowEventHandler(dataGridView1_NewRowNeeded);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;void dataGridView1_CellValuePushed(object sender, DataGridViewCellValueEventArgs e)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; _recSet.Move(e.RowIndex + 1);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; _recSet.Edit();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; _recSet[e.ColumnIndex + 1] = e.Value;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; _recSet.Update();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; } &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; void dataGridView1_CellValueNeeded(object sender, DataGridViewCellValueEventArgs e)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; _recSet.Move(e.RowIndex + 1);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; if (_recSet.Fields[e.ColumnIndex].Type == &#39;C&#39;)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; e.Value = _recSet[e.ColumnIndex + 1].ToString().Trim();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; else&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; e.Value = _recSet[e.ColumnIndex &amp;nbsp;+ 1];&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;private void btnAddRecord_Click(object sender, EventArgs e)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; _recSet.AddNew();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; _recSet.Update();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; this.dataGridView1.RowCount = _recSet.RecordCount;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingwithnoproblem.blogspot.com/feeds/4589062677652200205/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://programmingwithnoproblem.blogspot.com/2012/04/migrating-from-visual-fox-pro-to-sql.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157804888186498733/posts/default/4589062677652200205'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157804888186498733/posts/default/4589062677652200205'/><link rel='alternate' type='text/html' href='http://programmingwithnoproblem.blogspot.com/2012/04/migrating-from-visual-fox-pro-to-sql.html' title='Migrating from Visual Fox Pro to Sql Server. (Converting dbf to MS Sql Server etc) Second edition. Creating dbf file and editing data.'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05832334570814992067</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157804888186498733.post-9084644219876122710</id><published>2012-03-28T09:07:00.000-07:00</published><updated>2012-03-28T09:07:05.473-07:00</updated><title type='text'>Migrating from Visual Fox Pro to Sql Server. (Converting dbf to MS Sql Server etc))</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Hello to everyone again. Today I will start new posts, with beautifull name &quot;Migrating from VFP to MS SQL Server etc&quot;.&lt;br /&gt;
&amp;nbsp;Many years ago I was need to migrate from dbf format to MS Sql Server and PostgreSQL. I&#39;m made some researches. After that I &amp;nbsp;wrote utility that uses VFPOLEDB Provider and everything worked fine, to the moment when 64 bit system began to appear. So I was need to find new solution. Because this proveder works very bad under the 64 bit systems. So I created my own dll, that allows you to View, Manage, work with Indexes (full work with dbf). At the next posts I will show to you how it works.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingwithnoproblem.blogspot.com/feeds/9084644219876122710/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://programmingwithnoproblem.blogspot.com/2012/03/migrating-from-visual-fox-pro-to-sql.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157804888186498733/posts/default/9084644219876122710'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157804888186498733/posts/default/9084644219876122710'/><link rel='alternate' type='text/html' href='http://programmingwithnoproblem.blogspot.com/2012/03/migrating-from-visual-fox-pro-to-sql.html' title='Migrating from Visual Fox Pro to Sql Server. (Converting dbf to MS Sql Server etc))'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05832334570814992067</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157804888186498733.post-9094202789985755430</id><published>2012-03-20T05:40:00.001-07:00</published><updated>2012-03-20T05:40:35.594-07:00</updated><title type='text'>Transfering schema and data (SQL Server ), without SMO. Using only System.Data.SqlClient. Second part (Transfering data)</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
Hello to everyone. Here is the second part of our transfer methods without using SMO dlls.&lt;br /&gt;
I have new speed results. Something around 15 seconds. It&#39;s faster than previous method (using SMO which was 31 second). If you will have any questions please add comments or send me email. At next post I will write about migration data and structures from DBF &amp;nbsp;to the SQL Server. (x64 full support) Thanks.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&amp;nbsp;private void TestFunction2(string dbNameFrom, string dbNameTo)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; string cnnString = &quot;server=&quot; + Server + &quot;;user id=&quot; + UserId&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; + &quot;;password=&quot; + Password + &quot;;Initial Catalog = &quot; + dbNameFrom&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; + &quot;;Connect Timeout=30;Integrated Security=False;&quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; DataTable tbData = null;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; using (System.Data.SqlClient.SqlConnection cnn = new System.Data.SqlClient.SqlConnection(cnnString))&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cnn.Open();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (int i = 0; i &amp;lt; dataTables.Length; i++)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string tbName = dataTables[i];&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string cmdText = &quot; select * from &quot; + tbName;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; tbData = new DataTable(tbName);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; using (System.Data.SqlClient.SqlDataAdapter adapter = new System.Data.SqlClient.SqlDataAdapter(cmdText, cnn))&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; adapter.Fill(tbData);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Insertrecord(tbData, dbNameTo);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; tbData = null;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
private void Insertrecord(DataTable tb, string dbNameTo)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; string cnnStringTo = &quot;server=&quot; + Server + &quot;;user id=&quot; + UserId&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; + &quot;;password=&quot; + Password + &quot;;Initial Catalog = &quot; + dbNameTo&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; + &quot;;Connect Timeout=30;Integrated Security=False;&quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; using (System.Data.SqlClient.SqlConnection cnnTo = new System.Data.SqlClient.SqlConnection(cnnStringTo))&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cnnTo.Open();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string ccm = &quot;delete from &quot;+ tb.TableName;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; using (System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand(ccm, cnnTo))&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int result = cmd.ExecuteNonQuery();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string rr = &quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; GenerateInsertStatement(ref rr, tb);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.CommandText = rr;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (int j = 0; j &amp;lt; tb.Rows.Count; j++)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (int i = 0; i &amp;lt; tb.Columns.Count; i++)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; object val = tb.Rows[j][i];&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.AddWithValue(&quot;@&quot; + tb.Columns[i].ColumnName, val);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int res = cmd.ExecuteNonQuery();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Clear();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } &amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingwithnoproblem.blogspot.com/feeds/9094202789985755430/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://programmingwithnoproblem.blogspot.com/2012/03/transfering-schema-and-data-sql-server_20.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157804888186498733/posts/default/9094202789985755430'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157804888186498733/posts/default/9094202789985755430'/><link rel='alternate' type='text/html' href='http://programmingwithnoproblem.blogspot.com/2012/03/transfering-schema-and-data-sql-server_20.html' title='Transfering schema and data (SQL Server ), without SMO. Using only System.Data.SqlClient. Second part (Transfering data)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05832334570814992067</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157804888186498733.post-6819129780328507900</id><published>2012-03-15T10:01:00.001-07:00</published><updated>2012-03-15T10:01:41.891-07:00</updated><title type='text'>Transfering schema and data (SQL Server ), without SMO. Using only System.Data.SqlClient. First part (Transfering schemas)</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&amp;nbsp; &amp;nbsp;Hello to everybody, again. Today I will post the example of how we can transfering schema without using SMO(SqlServer).&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;You can ask &quot;man why this post in English? Your english is awful&quot;. And I can answer to you people : &quot;I want to practice in it&quot;. So, let&#39;s begin.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;private void TestFunction(string dbNameFrom, string dbNameTo)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; string cnnString = &quot;server=&quot; + Server + &quot;;user id=&quot; + UserId&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; + &quot;;password=&quot; + Password + &quot;;Initial Catalog = &quot; + dbNameFrom&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; + &quot;;Connect Timeout=30;Integrated Security=False;&quot;; &amp;nbsp;// for exaple&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; using (System.Data.SqlClient.SqlConnection cnn = new &amp;nbsp; &amp;nbsp; &amp;nbsp;System.Data.SqlClient.SqlConnection(cnnString))&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cnn.Open();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (int i = 0; i &amp;lt; schemaTables.Length; i++)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string tbName = schemaTables[i];&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string[] schemaCondition = { null, null, tbName };&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DataTable tbFrom = cnn.GetSchema(&quot;Columns&quot;, schemaCondition);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DataTable tbTo = null;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string cnnStringTo = &quot;server=&quot; + Server + &quot;;user id=&quot; + UserId&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; + &quot;;password=&quot; + Password + &quot;;Initial Catalog = &quot; + dbNameTo&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; + &quot;;Connect Timeout=30;Integrated Security=False;&quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; using (System.Data.SqlClient.SqlConnection cnnTo = new System.Data.SqlClient.SqlConnection(cnnStringTo))&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cnnTo.Open();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string[] schemaConditionTo = { null, null, tbName };&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; tbTo = cnnTo.GetSchema(&quot;Columns&quot;, schemaConditionTo);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AlterTable(tbFrom, tbTo, tbName, dbNameTo); // at this function we will be altering our table&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // insert data function will be here&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //for (int i = 0; i &amp;lt; dataTables.Length; i++)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// TODO at next post&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //}&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
private void AlterTable(DataTable tbFrom, DataTable tbTo, string tbName, string dbNameTo)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; string sqlStatement = &quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; string colName = &quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; string colDataType = &quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; string val = &quot;&quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; for (int i = 0; i &amp;lt;&amp;nbsp;
tbFrom.Rows.Count; i++)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DataRow r =&amp;nbsp;
tbFrom&amp;nbsp;Rows[i];&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; colName = r[&quot;Column_Name&quot;].ToString();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(ColumnExists(colName, tbTo))&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; continue;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sqlStatement = &quot;ALTER TABLE [dbo].[&quot; + tbName + &quot;] ADD &quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; colDataType = r[&quot;Data_Type&quot;].ToString();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; GetLength(colDataType, ref val, r);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sqlStatement += colName + &quot; &quot; + colDataType + val;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; // You can use connection from the previos method. Decided to make a new connection.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;// Only God will judge me.)&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string cnnStringTo = &quot;server=&quot; + Server + &quot;;user id=&quot; + UserId&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; + &quot;;password=&quot; + Password + &quot;;Initial Catalog = &quot; + dbNameTo&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; + &quot;;Connect Timeout=30;Integrated Security=False;&quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; using (System.Data.SqlClient.SqlConnection cnnTo = new System.Data.SqlClient.SqlConnection(cnnStringTo))&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cnnTo.Open();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand(sqlStatement, cnnTo);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.ExecuteNonQuery();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sqlStatement = &quot;&quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; } &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
private void GetLength(string type, ref string val, DataRow r)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; val = &quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; switch (type)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; case &quot;varchar&quot;:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; val = &quot;(&quot; + r[&quot;Character_Maximum_Length&quot;].ToString() + &quot;)&quot;; // for example&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; case &quot;float&quot;:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break; &amp;nbsp;// and so on&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; case &quot;int&quot;:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; case &quot;datetime&quot;: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break; &amp;nbsp; // and so on&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; case &quot;bit&quot;:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break; // and so on&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;// Here perhaps, you will be adding &quot;allow nulls&quot; property or not. I don&#39;t need it.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this moment I dont know exactly how fast is this function work&#39;s. Perhaps tomorrow, I will post the speed, of altering at the &quot;Transfer Data&quot; post.&lt;br /&gt;
Thank&#39;s to all, who is reading my post&#39;s. And for the other people, you dont miss nothing.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingwithnoproblem.blogspot.com/feeds/6819129780328507900/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://programmingwithnoproblem.blogspot.com/2012/03/transfering-schema-and-data-sql-server.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157804888186498733/posts/default/6819129780328507900'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157804888186498733/posts/default/6819129780328507900'/><link rel='alternate' type='text/html' href='http://programmingwithnoproblem.blogspot.com/2012/03/transfering-schema-and-data-sql-server.html' title='Transfering schema and data (SQL Server ), without SMO. Using only System.Data.SqlClient. First part (Transfering schemas)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05832334570814992067</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157804888186498733.post-4698333879427237943</id><published>2012-03-14T10:43:00.003-07:00</published><updated>2012-03-14T10:43:59.341-07:00</updated><title type='text'>Не о программировании, но про некие глюки с телефонами.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Ну так как блог предназначен для своих мыслей и всего остального что так сказать на ум пришло хочу поделиться своим опытом в решении одной проблемы с телефонами. Ну не все ж ведь о программировании говорить. Есть у меня телефончик Samsun Galaxy S i9003. Просто замечательный для меня да еще и приложения могу разрабатывать для Android ( дальше в тексту андруша). И вот в один довольно мрачный зимний вечер набираю я товарища (барабанная дробь), а вызов не идет. Сразу хочу сказать, что в настройках ничего не менял. Первое, что приходит обычно в голову человеку ну все таки я что то напортачил и надо бы сбросить все настройки до заводских. Но так как уже имел опыт сброса, после которого оказалось что коли ты сбросил настройки то и запись под аккаунт удалилась и все что ты скачивал под своего андрушу тоже исчезло. Скажу честно разбираться в причинах почему так все лихо гухнулось не стал. Ну зайду еще раз да скачаю. Ну да ладно, не о мне лентяя речь.&lt;br /&gt;
&amp;nbsp; &amp;nbsp;Долго рылся в настройках и обнаружилась одна вещь. По пути в телефоне&lt;br /&gt;
Настройки -&amp;gt; Вызовы -&amp;gt; Все вызовы - &amp;gt; Показывать мой номер установлено значение &quot;Скрыть&quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Поменяв его на &quot;По умолчанию&quot; мой андруша снова ожил и стал дозваниваться до нужных мне людей. Возможно вам это поможет в решении подобной проблемы. Если что был рад помочь.&lt;br /&gt;
&lt;br /&gt;
P.S Кстати до не нужных людей тоже стал дозваниваться. (Черный список не признаю)&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingwithnoproblem.blogspot.com/feeds/4698333879427237943/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://programmingwithnoproblem.blogspot.com/2012/03/blog-post_14.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157804888186498733/posts/default/4698333879427237943'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157804888186498733/posts/default/4698333879427237943'/><link rel='alternate' type='text/html' href='http://programmingwithnoproblem.blogspot.com/2012/03/blog-post_14.html' title='Не о программировании, но про некие глюки с телефонами.'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05832334570814992067</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157804888186498733.post-6705329874002058751</id><published>2012-03-14T09:09:00.001-07:00</published><updated>2012-03-14T09:09:41.026-07:00</updated><title type='text'>Starting developing on Macintosh, using XCode. First edition.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Немного про себя. Четыре года программирую приложения под Windows &amp;nbsp;и тут вдруг, словно гром среди ясного неба, попалась мне книженция по Objective C. Да и чего греха таить нарвался я на товарищей из стран заморских и диковенных (местами даже диких). И вот написал мне, на папирусе тонком да на&amp;nbsp;жидкокристаллическом пергаменте просматриваемом, их PM, что готов он мне тестовое задание дать, дабы удостовериться так сказать в моих возможностях. &amp;nbsp;Ну посмотрим прямо, ничего сверхсложного в этом objective C нет. Тем так сказать кто пописывал на С или С++ въехать не составит большого труда.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;В следующем цикле статей собираюсь приводить некоторые примеры на Objective C в контексте написания полноценного приложения.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;Очень важный аспект разработки под Макоси - это освоить XCode. Хотя на первых парах я постараюсь описывать действия необходимые для работы в этом чудесном IDE. (заметьте&amp;nbsp;&quot;чудесном&quot; без&amp;nbsp;кавычек).&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingwithnoproblem.blogspot.com/feeds/6705329874002058751/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://programmingwithnoproblem.blogspot.com/2012/03/starting-developing-on-macintosh-using.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157804888186498733/posts/default/6705329874002058751'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157804888186498733/posts/default/6705329874002058751'/><link rel='alternate' type='text/html' href='http://programmingwithnoproblem.blogspot.com/2012/03/starting-developing-on-macintosh-using.html' title='Starting developing on Macintosh, using XCode. First edition.'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05832334570814992067</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157804888186498733.post-2264058232193500671</id><published>2012-03-14T08:49:00.001-07:00</published><updated>2012-03-14T08:49:50.187-07:00</updated><title type='text'>Interesting thing about &quot;for&quot; cicle in C#. (Perhaps you dont know)</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
We have class Shape, that has only two properties (int CoordC, int CoordY).&lt;br /&gt;
And we have List&amp;lt;Shape&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Next step&lt;br /&gt;
Two test functions like:&lt;br /&gt;
&lt;br /&gt;
public void TestFunc1()&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; &amp;nbsp;int count = shapes.Count;&lt;br /&gt;
&amp;nbsp; string result = &quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; for (int i = 0; i &amp;lt; count; i++)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; result += &quot;Shape &quot; + i + shapes[i].CoordX.ToString() + &quot;\r\n&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public void TestFunc2()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; string result = &quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; for (int i = 0; i &amp;lt; shapes.Count; i++)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; result += &quot;Shape &quot; + i + shapes[i].CoordX.ToString() + &quot;\r\n&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Lets play the game? Why TestFunc2 will be faster? Count, of List items, doesnt matter.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingwithnoproblem.blogspot.com/feeds/2264058232193500671/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://programmingwithnoproblem.blogspot.com/2012/03/interesting-thing-about-for-cicle-in-c.html#comment-form' title='Комментарии: 1'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157804888186498733/posts/default/2264058232193500671'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157804888186498733/posts/default/2264058232193500671'/><link rel='alternate' type='text/html' href='http://programmingwithnoproblem.blogspot.com/2012/03/interesting-thing-about-for-cicle-in-c.html' title='Interesting thing about &quot;for&quot; cicle in C#. (Perhaps you dont know)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05832334570814992067</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157804888186498733.post-1548840817494548043</id><published>2012-03-13T08:52:00.000-07:00</published><updated>2012-03-14T14:23:33.808-07:00</updated><title type='text'>Transfer data an schema using SMO, but without &quot;Transfer&quot; class. More faster method I hope. Using Scripter Using Scripter instead.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Ну вот и получилось решение вопроса Transfer - а. При котором вам не потребуется наличие Integration Services установленного на вашем ПК. Что хотелось бы особо отметить в сравнении с предыдущим примером (Использование Transfer класса) данный способ работает в два раза быстрее. Хотя данные показатели могут разниться и утверждать, что &quot;Wow&quot; это просто чумовой прирост скорости трансфера данных, но таких громких заявлений делать не буду. Хотелось бы конечно по поводу скорости получить ваши&amp;nbsp;комментарии. Так вот сам способ (количество таблиц оставляем тоже и задача ставится такая же).&lt;br /&gt;
&lt;br /&gt;
private void TransferSchemaAndData()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; DataTable dataTable = db.EnumObjects(DatabaseObjectTypes.Table);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; List&amp;lt;Microsoft.SqlServer.Management.Sdk.Sfc.Urn&amp;gt; listSchema = new List&amp;lt;Microsoft.SqlServer.Management.Sdk.Sfc.Urn&amp;gt;();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; List&amp;lt;Microsoft.SqlServer.Management.Sdk.Sfc.Urn&amp;gt; listData = new List&amp;lt;Microsoft.SqlServer.Management.Sdk.Sfc.Urn&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;
FillLists&amp;nbsp;(listSchema, listData, dataTable); &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string PathToFile = Path.GetTempPath() + &quot;\\SomeTransferPackageName.sql&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Scripter scripter = new Scripter();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SettingUpScripter(ref scripter, srv, PathToFile);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Microsoft.SqlServer.Management.Sdk.Sfc.Urn[] urr = listSchema.ToArray();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; scripter.Script(urr);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; StreamReader rd = new StreamReader(PathToFile);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string script = rd.ReadToEnd();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Database toDb = srv.Databases[toDbName];&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DropTransferedTables(toDb);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; toDb.ExecuteNonQuery(script);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; rd.Close();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; listSchema.Clear();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; scripter.Options.ScriptSchema = false;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; scripter.Options.ScriptData = true; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; urr = listData.ToArray();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; scripter.EnumScript(urr); &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;rd = new StreamReader(PathToFile);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;script = rd.ReadToEnd();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ClearData(toDb);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;toDb.ExecuteNonQuery(script);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;rd.Close();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;listData.Clear();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (File.Exists(PathToFile))&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;File.Delete(PathToFile);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;} &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
private void &amp;nbsp;FillLists(List&amp;lt;Microsoft.SqlServer.Management.Sdk.Sfc.Urn&amp;gt; listSchema, List&amp;lt;Microsoft.SqlServer.Management.Sdk.Sfc.Urn&amp;gt; listData, DataTable dataTable)&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;foreach (System.Data.DataRow row in dataTable.Rows)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string tbName = row[&quot;Name&quot;].ToString();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (IsDataTableThatWeNeed(tbName))&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; listData.Add(new Microsoft.SqlServer.Management.Sdk.Sfc.Urn(row[&quot;Urn&quot;].ToString()));&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else if (IsSchemaTableThatWeNeed(tbName))&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; listSchema.Add(new Microsoft.SqlServer.Management.Sdk.Sfc.Urn(row[&quot;Urn&quot;].ToString()));&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
private void SettingUpScripter(ref Scripter scripter, Server srv, string PathToFile)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; scripter.Server = srv;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; scripter.Options.IncludeHeaders = true;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; scripter.Options.SchemaQualify = true;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; scripter.Options.SchemaQualifyForeignKeysReferences = true;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; scripter.Options.NoCollation = true;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; scripter.Options.DriAllConstraints = true;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; scripter.Options.DriAll = true;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; scripter.Options.DriAllKeys = true;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; scripter.Options.DriIndexes = true;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; scripter.Options.ClusteredIndexes = true;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; scripter.Options.NonClusteredIndexes = true;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; scripter.Options.ToFileOnly = true;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; scripter.Options.ScriptData = false;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; scripter.Options.ScriptSchema = true;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; scripter.Options.FileName = PathToFile;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Пока код не оптимизировался , так сказать первый набросок. В следующем посте расскажу по поводу некоторых функций который&amp;nbsp;здесь&amp;nbsp;использовались а так же опишу возникающие затруднения. В частности почему именно&amp;nbsp;Microsoft.SqlServer.Management.Sdk.Sfc.Urn. А не просто Urn.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingwithnoproblem.blogspot.com/feeds/1548840817494548043/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://programmingwithnoproblem.blogspot.com/2012/03/transfer.html#comment-form' title='Комментарии: 3'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157804888186498733/posts/default/1548840817494548043'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157804888186498733/posts/default/1548840817494548043'/><link rel='alternate' type='text/html' href='http://programmingwithnoproblem.blogspot.com/2012/03/transfer.html' title='Transfer data an schema using SMO, but without &quot;Transfer&quot; class. More faster method I hope. Using Scripter Using Scripter instead.'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05832334570814992067</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157804888186498733.post-6902095386448847504</id><published>2012-03-12T12:03:00.001-07:00</published><updated>2012-03-14T05:16:52.091-07:00</updated><title type='text'>SMO (SQL Server) for everyone</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Ну дак вот со времени моего последнего поста прошло около 5 часов и кажется целые сутки серфинга в интернете. В результате чего все таки пришел к выводу, который звучит приблизительно так &quot; Почему бы не написать свою dll - шку для общечеловеческого пользования ей.&quot;. Завтра планирую выложить &amp;nbsp;ее исходники. Все таки ставить Integration Services совсем не хочется ибо как то это&amp;nbsp;громоздко для такой задачки.&amp;nbsp; Кстати у кого по этому поводу есть соображения или же предложения прошу поделиться. Возможно кто то нашел решение как использовать SMO без&amp;nbsp;инсталляции&amp;nbsp;Services.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingwithnoproblem.blogspot.com/feeds/6902095386448847504/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://programmingwithnoproblem.blogspot.com/2012/03/5.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157804888186498733/posts/default/6902095386448847504'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157804888186498733/posts/default/6902095386448847504'/><link rel='alternate' type='text/html' href='http://programmingwithnoproblem.blogspot.com/2012/03/5.html' title='SMO (SQL Server) for everyone'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05832334570814992067</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157804888186498733.post-527821327442629161</id><published>2012-03-12T06:17:00.003-07:00</published><updated>2012-03-14T05:18:10.210-07:00</updated><title type='text'>some stuff with SMO and Integration Services.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
И вот наступил следующий этап моих странствований по чудному и полному тайн миру SMO библиотек. Поставил я себе задачу, которая заключается в удаленном управлении сервером(управление &amp;nbsp;базами данных, создании таблиц и так далее), но как всегда есть одно маленькое НО. На машине на которой устанавливается приложение не установлен SQL Server.&lt;br /&gt;
Сразу небольшая оговорка ВСЕ&amp;nbsp;ниже перечисленные&amp;nbsp;dll все таки&amp;nbsp;придется&amp;nbsp;где то взять на сколько мне известно все эти dll - ки можно использовать для&amp;nbsp;коммерческого&amp;nbsp;использования.&lt;br /&gt;
Поясню. В referances прицеплены все необходимые dll и они же и используются(сразу дабы отсечь умников, которые бы сказали ну так ты их прицепил а вот используешь совсем не те).&lt;br /&gt;
Вот список этих dll&lt;br /&gt;
Microsoft.SqlServer.ConnectionInfo&lt;br /&gt;
Microsoft.SqlServer.Management.Sdk.Sfc&lt;br /&gt;
Microsoft.SqlServer.Smo&lt;br /&gt;
Microsoft.SqlServer.SmoExtended&lt;br /&gt;
&lt;br /&gt;
Так что тут все в норме. Так запустив приложение натыкаемся на такую вот ошибку&lt;br /&gt;
The Integration Services component is not installed &amp;nbsp;or you do not have permission to use it.&lt;br /&gt;
Ошибка понятна и прозрачна. Возникает из за того что при вызове метода TransferData() идет загрузка такой вот штуки Microsoft.SqlServer.DtsTransferProvider, Microsoft.SQLServer.DTSRuntimeWrap.dll,&lt;br /&gt;
Microsoft.SQLServer.ManagedDTS.dll&amp;nbsp; и еще несколько других dll которые регестрятся в GAC при установке Integration Services.&lt;br /&gt;
&amp;nbsp;И вот вы потратив пару десятков минут и прицепив все необходимые dll получаете, что то вроде&lt;br /&gt;
этого:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&quot;An Integration Services class cannot be found. Make sure that Integration Services is&lt;br /&gt;
&amp;nbsp; correctly installed on the computer that is running the application. Also, make sure that the 64-bit version&lt;br /&gt;
&amp;nbsp; of Integration Services is installed if you are running a 64-bit application. &quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Integration Services НАДО СТАВИТЬ. Что с моей точки зрения немного не удобно для разработчиков. Проблему можно попробовать решить при помощи выполнения удаленных Package - ей, что не совсем то, что хотелось. В следующем посте расскажу каким образом будем выкручиваться из сложившихся,&amp;nbsp;сжимающих&amp;nbsp;нас рамок. &amp;nbsp;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingwithnoproblem.blogspot.com/feeds/527821327442629161/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://programmingwithnoproblem.blogspot.com/2012/03/smo.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157804888186498733/posts/default/527821327442629161'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157804888186498733/posts/default/527821327442629161'/><link rel='alternate' type='text/html' href='http://programmingwithnoproblem.blogspot.com/2012/03/smo.html' title='some stuff with SMO and Integration Services.'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05832334570814992067</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157804888186498733.post-6023273020729712725</id><published>2012-03-12T01:58:00.003-07:00</published><updated>2012-03-14T05:19:41.198-07:00</updated><title type='text'>SMO (SQL Server) how to use &quot;Transfer&quot; class to transfer datas and schemas. I hope it would be helpfull.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Доброго времени суток. Вот Сейчас представлю реальный пример работы с классом C# Transfer.&lt;br /&gt;
Смысл заключается в трансфере сначала одного набора объектов (только структуры таблиц ), после чего трансферится и структуры и данные. Довольно удобная штука если вам необходимо используя SMO выполнить трансфер с одного сервера на другой или же выполнить трансфер в рамках одного сервера. И так код:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;public void CopyDbStruct(string fromDbName, string toDbName)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; string[] dataTables = new string[] { &quot;Table1&quot;, &quot;
Table2&amp;nbsp;&quot;, &quot;
Table3&amp;nbsp;&quot;, &quot;
Table4&amp;nbsp;&quot;, &amp;nbsp;&quot;
Table5&amp;nbsp;&quot;, &quot;
Table6&amp;nbsp;&quot;, &quot;
Table7&amp;nbsp;&quot;, &quot;
Table8&amp;nbsp;&quot; };&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; string[] schemaTables = new string[] {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;TableSch1&quot;, &quot;
TableSch2&quot;, &quot;
TableSch3&quot;, &quot;
TableSch4&quot;,&quot;
TableSch5&amp;nbsp;&quot;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;TableSch6&quot;, &quot;
TableSch7&quot;, &quot;
TableSch8&quot;, &quot;
TableSch9&quot;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;
TableSch10&quot;, &quot;
TableSch11&quot;, &quot;
TableSch12&quot;, &quot;
TableSch13&quot;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;
TableSch14&quot;, &quot;
TableSch15&quot;, &quot;
TableSch16&quot;, &quot;
TableSch17&quot;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;
TableSch18&quot;, &quot;
TableSch19&quot;, &quot;
TableSch20&quot;, &quot;
TableSch21&quot;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;
TableSch22&quot;, &quot;
TableSch23&quot;, &quot;
TableSch24&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; Server srv = new Server(&quot;Earth\\SQLSERVER&quot;); &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; srv.ConnectionContext.LoginSecure = false;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; srv.ConnectionContext.Login = UserName;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; srv.ConnectionContext.Password = Password;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; Database db = srv.Databases[fromDbName];&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; if (db != null)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Transfer tr = new Transfer(db);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; tr.CopyAllObjects = false;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; tr.CopyAllTables = false;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; tr.DestinationServer = srv.Name;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; tr.DestinationDatabase = toDbName;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; tr.Options.IncludeIfNotExists = true;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; tr.CopySchema = true;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; tr.CopyData = false;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; tr.DestinationLoginSecure = false;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; tr.DestinationLogin = UserName;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; tr.DestinationPassword = Password;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; tr.DropDestinationObjectsFirst = true;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// заполняем&amp;nbsp;ObjectList таблицами из которых мы хотим переместить только схему&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (int i = 0; i &amp;lt; schemaTables.Length; i++)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; tr.ObjectList.Add(db.Tables[schemaTables[i]]);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; tr.TransferData(); // выполняем трансфер&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; tr.ObjectList.Clear(); // после чего очищаем список&amp;nbsp;ObjectList для последующего добавление в него других данных.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; tr.CopyData = true; // оба эти флага говорят что переносить будем и схему и структуру&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; tr.CopySchema = true;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// заполняем&amp;nbsp;ObjectList таблицами из которых мы хотим переместить и схему и данные&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (int i = 0; i &amp;lt; dataTables.Length; i++)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; tr.ObjectList.Add(db.Tables[dataTables[i]]);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; tr.TransferData(); // и теперь уже заливаем в нужную на базу таблицы с данными.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Способ проверен в реальной ситуации, на реальных таблицах. Сразу приготовьтесь к тому что этот процесс займет некоторое время.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingwithnoproblem.blogspot.com/feeds/6023273020729712725/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://programmingwithnoproblem.blogspot.com/2012/03/blog-post_12.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157804888186498733/posts/default/6023273020729712725'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157804888186498733/posts/default/6023273020729712725'/><link rel='alternate' type='text/html' href='http://programmingwithnoproblem.blogspot.com/2012/03/blog-post_12.html' title='SMO (SQL Server) how to use &quot;Transfer&quot; class to transfer datas and schemas. I hope it would be helpfull.'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05832334570814992067</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157804888186498733.post-3479382385838500782</id><published>2012-03-10T13:44:00.001-08:00</published><updated>2012-03-14T05:21:00.092-07:00</updated><title type='text'>My first steps in blogging. Second edition.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Всем доброго времени суток. Как то по работе попалась задача осуществить Transfer данных из одного набора таблиц в другую базу. Что хотелось бы сказать относитесь к мелочам со всей тщательностью как говорит мой учитель и главный наставник моей жизни. Потому как обычно все проблемы кроются в вашей не внимательности.&amp;nbsp;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingwithnoproblem.blogspot.com/feeds/3479382385838500782/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://programmingwithnoproblem.blogspot.com/2012/03/blog-post_10.html#comment-form' title='Комментарии: 1'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157804888186498733/posts/default/3479382385838500782'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157804888186498733/posts/default/3479382385838500782'/><link rel='alternate' type='text/html' href='http://programmingwithnoproblem.blogspot.com/2012/03/blog-post_10.html' title='My first steps in blogging. Second edition.'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05832334570814992067</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4157804888186498733.post-6472890130978803920</id><published>2012-03-10T13:29:00.002-08:00</published><updated>2012-03-14T05:21:37.605-07:00</updated><title type='text'>My first steps in blogging. First edition.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Всем доброго времени суток. Ни для кого не секрет что первый способ решения проблем програмирования это прильнуть к кружечке холодного пива. ) А дальше я готов поделиться всем что знаю а так же спросить у вас &amp;nbsp;то что не знаю. Вперед мои кибернетические товарищи.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingwithnoproblem.blogspot.com/feeds/6472890130978803920/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://programmingwithnoproblem.blogspot.com/2012/03/blog-post.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4157804888186498733/posts/default/6472890130978803920'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4157804888186498733/posts/default/6472890130978803920'/><link rel='alternate' type='text/html' href='http://programmingwithnoproblem.blogspot.com/2012/03/blog-post.html' title='My first steps in blogging. First edition.'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05832334570814992067</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>