Hi, Today tried a sample to fetch Area and perimeter of a surface using ArcGIS API with Google maps. It is easy to use, we just need to join the points for the respective surface for which we need to find the Area & perimeter and double click. I always like Central park in Newyork, Thought let us try the tool there... It works perfect... please find the link & screen shot below.
} class aawservice { public DataSet ConvertDataReaderToDataSet(System.Data.Odbc.OdbcDataReader reader) { DataSet dataSet = new DataSet(); do { // Create data table in runtime DataTable schemaTable = reader.GetSchemaTable(); DataTable dataTable = new DataTable();
if (schemaTable != null) { for (int i = 0; i < schemaTable.Rows.Count; i++) { DataRow dataRow = schemaTable.Rows[i];
// Create a column name as provided in Schema string columnName = (string)dataRow["ColumnName"];
// Define Column Type here DataColumn column = new DataColumn(columnName, (Type)dataRow["DataType"]);
//Adding Column to table dataTable.Columns.Add(column); }
dataSet.Tables.Add(dataTable);
// Fill the data table from reader data
while (reader.Read()) { DataRow dataRow = dataTable.NewRow(); for (int i = 0; i < reader.FieldCount; i++) dataRow[i] = reader.GetValue(i); dataTable.Rows.Add(dataRow); } }
else { // No records were returned DataColumn column = new DataColumn("RowsAffected"); dataTable.Columns.Add(column); dataSet.Tables.Add(dataTable); DataRow dataRow = dataTable.NewRow(); dataRow[0] = reader.RecordsAffected; dataTable.Rows.Add(dataRow); } } while (reader.NextResult()); return dataSet; } }
I had an interesting requirement to generate daily reports based on the accumulated sales data. And this Email will be sent to the respective Managers. Thought it would give a better picture if the email have the appropriate Brand images embedded on necessary places in report.
Following code was very much useful to embed an image in a system generated e-mail through C#.
So far we have written applications to talk to various Databases. This is the first time, wrote a C# .Net console application to fetch records from DB2. Following is the sample code.
Code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Data.Odbc;
classProgram
{
staticvoid Main()
{
OdbcCommand cmd = null;
OdbcConnection con = null;
OdbcDataReader rdr = null;
try
{
con = newOdbcConnection("DSN={LibName};UID={User Name};PWD={Password};" + "Driver={IBM DB2 ODBC DRIVER};");
I had a requirement to create a application to retrieve data from legacy MS-Access application. I was looking for a sample in google. could'nt find one. So posting it so that it could be useful for people who is looking for the same.
I have created a DNS for the mdb file. used System.Data.Odbc; and rest are similar to how we do for SQL. following is the sample code.
staticvoid Main(string[] args)
{
//Read Data from Access
OdbcConnection ODBCConnection = new System.Data.Odbc.OdbcConnection("DSN=DNS_Test_MSACCESS;UID=sam;PWD=mam;");
// ODBCConnection= new OdbcConnection(ConnString);
ODBCConnection.Open();
OdbcCommand ODBCCommand = new OdbcCommand("select * from Table1", ODBCConnection);
Seems people search for Sample MOSS webpart and land into my previous blog where i have written how to develop a webpart from your XP machine. So let us provide what people came looking for....
Following is a sample web part i created some time back which fetches data from database and displays in a table. The web part class should always inherit Webpart(System.Web.UI.WebControls.WebParts) as base class. For webparts we usually write the code to override any events like Render, RenderWebPart or RenderContent. In the sample code i have overrided Render event which takes the parameter System.Web.UI.HtmlTextWriter object.
The Database operations i have used Application blocks from Enterprise Library
6. Reset IIS 7. Go to Site Action -> Settings -> Webparts -> New
8. You will find your webpart in the URL: http://YOURMOSSSERVER/_layouts/NewDwp.aspx .Select the checkbox for the respective webpart & click Populate Gallery Button.
9. Now go to any page in the site and in Edit mode you will be able to find the webpart to add it in your page.... Thats it...
Note: With the help of Web Part templates in visual studio the above steps are made much more easier! you can just click on RUN button. The studio it-self will deploy & reset the IIS, you can directly go to the page and add the Web part! Love you Templates :)