<?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-6451522063295640517</id><updated>2024-09-16T19:18:42.387-07:00</updated><category term="bulk upload"/><category term="excel upload in sql server"/><category term="file upload utility"/><category term="sap and dotnet"/><category term="sap connector 3.0"/><category term="sap dotnet connector 3.0"/><category term="sapdotnetconnector 3.0"/><category term="sql server 2008"/><category term="user control"/><title type='text'>Coder&#39;s Blog</title><subtitle type='html'>A simple Blog about Code(s) around Microsoft Technologies.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://blog4coders.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6451522063295640517/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://blog4coders.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>San</name><uri>http://www.blogger.com/profile/10880659784302428470</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>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6451522063295640517.post-6826253539169285650</id><published>2011-11-25T05:24:00.000-08:00</published><updated>2011-11-25T05:26:22.499-08:00</updated><title type='text'>Dare Devil Act (Khatron K Khiladi)</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;iframe allowfullscreen=&#39;allowfullscreen&#39; webkitallowfullscreen=&#39;webkitallowfullscreen&#39; mozallowfullscreen=&#39;mozallowfullscreen&#39; width=&#39;320&#39; height=&#39;266&#39; src=&#39;https://www.blogger.com/video.g?token=AD6v5dx7EgyznyTquWbSe-s0isBREgPY_vadMUTxxnM2tziFYCGZ5emQ49ufQTK80tCfJl6f6hAz1veZQHIJa7329Q&#39; class=&#39;b-hbp-video b-uploaded&#39; frameborder=&#39;0&#39;&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog4coders.blogspot.com/feeds/6826253539169285650/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6451522063295640517/6826253539169285650' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6451522063295640517/posts/default/6826253539169285650'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6451522063295640517/posts/default/6826253539169285650'/><link rel='alternate' type='text/html' href='http://blog4coders.blogspot.com/2011/11/dare-devil-act-khatron-k-khiladi.html' title='Dare Devil Act (Khatron K Khiladi)'/><author><name>San</name><uri>http://www.blogger.com/profile/10880659784302428470</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-6451522063295640517.post-8323887087280373495</id><published>2011-02-16T20:49:00.000-08:00</published><updated>2011-02-16T20:56:17.501-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="bulk upload"/><category scheme="http://www.blogger.com/atom/ns#" term="excel upload in sql server"/><category scheme="http://www.blogger.com/atom/ns#" term="sql server 2008"/><title type='text'>Bulk Upload of Excel in SQL SERVER</title><content type='html'>This Stored PRocedure takes the Uploaded Path of excel and inserts the fields in a table as defined.&lt;br /&gt;&lt;br /&gt;CREATE PROCEDURE Procedure_Name&lt;br /&gt;@ExcelPath text, @STATUSTEXT NVARCHAR(1) OUTPUT&lt;br /&gt;AS&lt;br /&gt;BEGIN&lt;br /&gt; DECLARE @intErrorCode INT&lt;br /&gt; SET NOCOUNT OFF;&lt;br /&gt;BEGIN TRAN SP_TRAN &lt;br /&gt;DECLARE&lt;br /&gt;@service_provider varchar(300),&lt;br /&gt;@path varchar(300),&lt;br /&gt;@dbtype varchar(500),&lt;br /&gt;@query varchar(300),&lt;br /&gt;@datasource varchar(300) &lt;br /&gt;set @service_provider=&#39;Microsoft.Jet.OLEDB.4.0&#39; &lt;br /&gt;set @dbtype=&#39;Excel 8.0;DATABASE=&#39;&lt;br /&gt;set @path=@ExcelPath&lt;br /&gt;set @query=&#39;select * from [Sheet1$]&#39;&lt;br /&gt;set @datasource=@dbtype+@path&lt;br /&gt;   &lt;br /&gt;EXEC(&#39;INSERT INTO Table_Name (Field1, Field2, Field3) SELECT convert(date, [Date],105), ltrim(rtrim(ExcelField1)) ,ltrim(rtrim(ExcelField2)) ,ltrim(rtrim(ExcelField3)) FROM OPENROWSET (&#39;&#39;&#39;+@service_provider+&#39;&#39;&#39;,  &#39;&#39;&#39;+@datasource+&#39;&#39;&#39;,  &#39;&#39;&#39;+@query+ &#39;&#39;&#39;) a&#39;) &lt;br /&gt;&lt;br /&gt;SELECT @intErrorCode = @@ERROR&lt;br /&gt;  IF (@intErrorCode &lt;&gt; 0) GOTO PROBLEM &lt;br /&gt;&lt;br /&gt;COMMIT TRAN&lt;br /&gt;SELECT @STATUSTEXT = &#39;0&#39;&lt;br /&gt;    &lt;br /&gt;PROBLEM:&lt;br /&gt;   IF (@intErrorCode &lt;&gt; 0) &lt;br /&gt; BEGIN&lt;br /&gt;     SELECT @STATUSTEXT = &#39;1&#39;&lt;br /&gt;    ROLLBACK TRAN&lt;br /&gt; END &lt;br /&gt;SET NOCOUNT ON;&lt;br /&gt;END</content><link rel='replies' type='application/atom+xml' href='http://blog4coders.blogspot.com/feeds/8323887087280373495/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6451522063295640517/8323887087280373495' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6451522063295640517/posts/default/8323887087280373495'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6451522063295640517/posts/default/8323887087280373495'/><link rel='alternate' type='text/html' href='http://blog4coders.blogspot.com/2011/02/bulk-upload-of-excel-in-sql-server.html' title='Bulk Upload of Excel in SQL SERVER'/><author><name>San</name><uri>http://www.blogger.com/profile/10880659784302428470</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-6451522063295640517.post-3594603667702198229</id><published>2011-02-15T22:03:00.000-08:00</published><updated>2011-02-16T20:56:54.798-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="file upload utility"/><category scheme="http://www.blogger.com/atom/ns#" term="user control"/><title type='text'>File Upload User Control</title><content type='html'>&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;/span&gt;What it does?&lt;br /&gt;&lt;/span&gt;The utility is a small user control that has the following in the ascx file&lt;br /&gt;&lt;br /&gt;a. asp Label for texts before the file upload&lt;br /&gt;b. asp file upload&lt;br /&gt;c. asp Button&lt;br /&gt;d. asp Label for Status.&lt;br /&gt;&lt;br /&gt;In the ascx.cs file&lt;br /&gt;There are 3 properties&lt;br /&gt;a. setLabelText/getLabelText&lt;br /&gt;b. setButtonText/getButtonText&lt;br /&gt;c. setUploadPath/getUploadPath&lt;br /&gt;and a delegate to pass the file full path with file name to the aspx page that is calling the User Control.&lt;br /&gt;In the Page Load, the Text of the Labels are set that are passed by the calling page.&lt;br /&gt;In the Button Click Event, the file is uploaded and the status of the Error Label is set and finally we are setting the event with the string filename.&lt;br /&gt;&lt;br /&gt;In the aspx page, in Page Load we are setting the properties, calling the delegate and just writing the file path in the screen, this can be used to pass the information to a SP for Bulk Upload of the Excel File in database. (in another post )&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;br /&gt;Put the following code in ascx file &lt;/span&gt;&lt;br /&gt;&amp;lt;div&amp;gt;&lt;br /&gt;&amp;lt;span&amp;gt;&lt;br /&gt;&amp;lt;asp:label id=&quot;lblUpload&quot; runat=&quot;server&quot;&amp;gt;&amp;lt;/asp:label&amp;gt;: &amp;lt;asp:fileupload id=&quot;txtUpload&quot; runat=&quot;server&quot;&amp;gt;&lt;br /&gt;&amp;lt;/asp:fileupload&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;&amp;lt;span&amp;gt;&amp;lt;asp:button runat=&quot;server&quot; id=&quot;btnUpload&quot; onclick=&quot;btnUpload_Click&quot;&amp;gt;&amp;lt;/asp:button&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;&amp;lt;span&amp;gt; &amp;lt;asp:label id=&quot;lblError&quot; runat=&quot;server&quot;&amp;gt;&amp;lt;/asp:label&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Put the following in .ascx.cs file&lt;/span&gt;&lt;br /&gt;  public delegate void SendMsgToPage(string MessageToPage);&lt;br /&gt;&lt;br /&gt;public partial class UploadFile : System.Web.UI.UserControl&lt;br /&gt;{&lt;br /&gt;  public event SendMsgToPage sndMsgToPage;&lt;br /&gt;  private string _setLabelText, _setButtonText, _fileUploadPath, _file, _dbData;&lt;br /&gt;  bool _WriteToDb;&lt;br /&gt;&lt;br /&gt;  public void setLabelText(string Text)&lt;br /&gt;  {&lt;br /&gt;      _setLabelText = Text;&lt;br /&gt;  }&lt;br /&gt;  public string getLabelText()&lt;br /&gt;  {&lt;br /&gt;      if (_setLabelText == null || _setLabelText == &quot;&quot;)&lt;br /&gt;      {&lt;br /&gt;          _setLabelText = &quot;Select File&quot;;&lt;br /&gt;      }&lt;br /&gt;      return _setLabelText;&lt;br /&gt;  }&lt;br /&gt;  public void setButtonText(string Text)&lt;br /&gt;  {&lt;br /&gt;      _setButtonText = Text;&lt;br /&gt;  }&lt;br /&gt;  public string getButtonText()&lt;br /&gt;  {&lt;br /&gt;      if (_setButtonText == null || _setButtonText == &quot;&quot;)&lt;br /&gt;      {&lt;br /&gt;          _setButtonText = &quot;Upload&quot;;&lt;br /&gt;      }&lt;br /&gt;      return _setButtonText;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public void setUploadPath(string Text)&lt;br /&gt;  {&lt;br /&gt;      _fileUploadPath = Text;&lt;br /&gt;  }&lt;br /&gt;  public string getUploadPath()&lt;br /&gt;  {&lt;br /&gt;      if (_fileUploadPath == null || _fileUploadPath == &quot;&quot;)&lt;br /&gt;      {&lt;br /&gt;          _fileUploadPath = &quot;Uploads&quot;;&lt;br /&gt;      }&lt;br /&gt;      return _fileUploadPath;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;  {&lt;br /&gt;          lblUpload.Text = _setLabelText;&lt;br /&gt;          btnUpload.Text = _setButtonText;&lt;br /&gt;          lblError.Visible = false;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  protected void btnUpload_Click(object sender, EventArgs e)&lt;br /&gt;  {&lt;br /&gt;      lblError.Visible = true;&lt;br /&gt;      try&lt;br /&gt;      {&lt;br /&gt;          _file = Server.MapPath(_fileUploadPath) + &quot;\\&quot; + txtUpload.FileName;&lt;br /&gt;          txtUpload.SaveAs(_file);&lt;br /&gt;          lblError.Text = &quot;File: &quot; + txtUpload.FileName + &quot; Uploaded Successfully&quot;;&lt;br /&gt;      }&lt;br /&gt;      catch (Exception ex)&lt;br /&gt;      {&lt;br /&gt;          _file = &quot;&quot;;&lt;br /&gt;          lblError.Text = &quot;File: &quot; + txtUpload.FileName + &quot; couldnot be uploaded due to &quot; + ex.Message;&lt;br /&gt;      }&lt;br /&gt;      finally&lt;br /&gt;      {&lt;br /&gt;          sndMsgToPage(_file);&lt;br /&gt;      }&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Put the following in the aspx file calling the User Control&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;%@ Register src=&quot;Controls/UploadFile.ascx&quot; tagname=&quot;UploadFile&quot; tagprefix=&quot;uc1&quot; %&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;uc1:uploadfile id=&quot;fileUpd&quot; runat=&quot;server&quot;&amp;gt;&lt;br /&gt;&amp;lt;/uc1:uploadfile&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;in the aspx.cs file&lt;/span&gt;&lt;br /&gt;      fileUpd.setLabelText(Put Label Text);&lt;br /&gt;      fileUpd.setButtonText(Put Button Text);&lt;br /&gt;      fileUpd.setUploadPath(Set the Upload Path); //should be a folder  inside the current project&lt;br /&gt;      fileUpd.sndMsgToPage += delegate(string fileUploadPath)&lt;br /&gt;      {&lt;br /&gt;                   Response.Write(fileUploadPath);&lt;br /&gt;      };&lt;/blockquote&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog4coders.blogspot.com/feeds/3594603667702198229/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6451522063295640517/3594603667702198229' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6451522063295640517/posts/default/3594603667702198229'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6451522063295640517/posts/default/3594603667702198229'/><link rel='alternate' type='text/html' href='http://blog4coders.blogspot.com/2011/02/file-upload-user-control.html' title='File Upload User Control'/><author><name>San</name><uri>http://www.blogger.com/profile/10880659784302428470</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-6451522063295640517.post-7372090770640990313</id><published>2011-02-07T21:52:00.000-08:00</published><updated>2011-02-17T21:07:15.216-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="sap and dotnet"/><category scheme="http://www.blogger.com/atom/ns#" term="sap connector 3.0"/><category scheme="http://www.blogger.com/atom/ns#" term="sap dotnet connector 3.0"/><category scheme="http://www.blogger.com/atom/ns#" term="sapdotnetconnector 3.0"/><title type='text'>SAP DOTNET CONNECTOR 3.0</title><content type='html'>Sap came with a new version (3.0) of SAP Connector for Dotnet last Dec. It made the SAP connectivity from Dotnet easier compared to the Last Version (SAPConnector 2.0). Earlier the connector only worked with C# in VS 2003. It created a proxy for the SAP RFC ( Remote Function Call) beign called and so at any point of time if the RFC was modified the proxy needs to be re-generated. Now with 3.0 it is much easier to code with. Reference the &quot;&lt;strong&gt;&lt;u&gt;sapnco.dll&lt;/u&gt;&lt;/strong&gt;&quot; and the &quot;&lt;strong&gt;&lt;u&gt;sapnco_utils.dll&lt;/u&gt;&lt;/strong&gt;&quot; in your VS project (version doesnot matter, it can be 2K3/2K5/2K8).&lt;br /&gt;Add the following code&lt;br /&gt;const string ABAP_AS_POOLED = &quot;DV&quot;;&lt;br /&gt;RfcDestination destination = RfcDestinationManager.GetDestination(ABAP_AS_POOLED);&lt;br /&gt;IRfcFunction function = null;&lt;br /&gt;RfcSessionManager.BeginContext(destination);&lt;br /&gt;&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;function = destination.Repository.CreateFunction(Your RFC Function);&lt;br /&gt;function.SetValue(RFC Import Parameter, Value to be Passed);&lt;br /&gt;function.Invoke(destination);&lt;br /&gt;IRfcTable detail = function[RFC Function Out Table].GetTable();&lt;br /&gt;for (int i = 0; i &lt; detail.RowCount; i++)&lt;br /&gt;{&lt;br /&gt;//set the current row - the row used for Get*/Set* operations&lt;br /&gt;Response.Write(detail.GetValue(i));&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;catch (RfcBaseException ex)&lt;br /&gt;{&lt;br /&gt;Response.Write(ex.ToString());&lt;br /&gt;return;&lt;br /&gt;}&lt;br /&gt;The above code just gives a brief idea of how to call a RFC.&lt;br /&gt;For binding the output with a DataGrid/GridView, One has to create a datatable and update it and then bind the data table with the DataGrid/GridView.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Link to SAP Blog Help &lt;/span&gt;&lt;br /&gt;http://weblogs.sdn.sap.com/cs/blank/view/wlg/23051</content><link rel='replies' type='application/atom+xml' href='http://blog4coders.blogspot.com/feeds/7372090770640990313/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6451522063295640517/7372090770640990313' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6451522063295640517/posts/default/7372090770640990313'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6451522063295640517/posts/default/7372090770640990313'/><link rel='alternate' type='text/html' href='http://blog4coders.blogspot.com/2011/02/sap-dotnet-connector-30.html' title='SAP DOTNET CONNECTOR 3.0'/><author><name>San</name><uri>http://www.blogger.com/profile/10880659784302428470</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>