Thursday, September 25, 2008

Insert Blank Value in Access Database sample c#

Date
if
(txtpayDate.Text.Length == 0){cmd.Parameters["@ENTDATE"].Value = DBNull.Value;}
text

if

(txtCaseNO.Text.Length == 0){cmd.Parameters["@CASEID"].Value = DBNull.Value;}

Wednesday, September 24, 2008

Sql - All Cost type and Amount in Same Row F4105 JDEdwards table

All Cost type and Amount in Same Row F4105 table, We are not keeping price location wise

select a.colitm,a.comcu,a.coledg CostTy02,cast(a.councs/10000 as decimal (15,4)) Cost02,isnull(b.coledg,'') CostTy21,
isnull(cast(b.councs/10000 as decimal (15,4)),0) Cost21,isnull(c.coledg,'') CostTy25,isnull(cast(c.councs/10000 as decimal (15,4))/10000,0) Cost25
from proddta.f4105 a
left outer join proddta.f4105 b on a.colitm=b.colitm and a.comcu=b.comcu and b.coledg='21'
left outer join proddta.f4105 c on a.colitm=c.colitm and a.comcu=c.comcu and c.coledg='25'
where a.coledg='02' and a.coitm<>0 and a.colocn='' and a.councs<>0





Wednesday, September 17, 2008

Scratchpad/Signature Capture as BMP on Pocket PC.

CodeProject: Scratchpad/Signature Capture as BMP on Pocket PC. Free source code and programming help
This control class allows a user to take a colored jot down note or signature, and save it as BMP file in the Pocket PC. This easy to use code can be plugged into any .NET application to take scribbles.
Background

http://69.10.233.10/KB/mobile/Signature_Capture_PPC.aspx

Capture the mouse movement in web service.

CodeProject: Capture the mouse movement in web service. Free source code and programming help

JavaScript to close child windows

check this out
http://www.codeproject.com/KB/scripting/WebChildren.aspx
 


Get more out of the Web. Learn 10 hidden secrets of Windows Live. Learn Now

SQLite Membership, Role, and Profile Providers

SQLite Membership, Role, and Profile Providers
This is an implementation of the Membership, Role, and Profile providers for ASP.NET 2.0. It is fully functional, except there is no support for saving or reading binary objects to/from the profile provider.
Check this out:
 
http://www.codeproject.com/KB/aspnet/SQLite-Providers.aspx
 


Want to do more with Windows Live? Learn "10 hidden secrets" from Jamie. Learn Now

Drools.NET - Getting Started

Drools.NET is a Business Rules Engine (BRE) based on Charles Forgy's Rete algorithm. Developers can now exploit a powerful Rule Engine through a completely managed .NET code base! Drools.NET is based on Jboss Rules, and comes with all the features of that Rules Engine. 
 
More Information check the following links:
 
Getting Started with Drools.NET:- http://www.codeproject.com/KB/cs/Drools_NETPrimer.aspx
Drools.NET is a Business Rules Engine :- http://droolsdotnet.codehaus.org/
 
 
 
 
 


Want to do more with Windows Live? Learn "10 hidden secrets" from Jamie. Learn Now

SQL SERVER - 2008 - Creating Full Text Catalog and Full Text Search

CodeProject: SQL SERVER - 2008 - Creating Full Text Catalog and Full Text Search. Free source code and programming help

Full Text Index helps to perform complex queries against character data. These queries can include word or phrase searching. We can create a full-text index on a table or indexed view in a database. Only one full-text index is allowed per table or indexed view. The index can contain up to 1024 columns. This feature works with RTM (Ready to Manufacture) version of SQL Server 2008 and does not work on CTP (Community Technology Preview) versions.
To create an Index, follow the steps:
Create a Full-Text Catalog
Create a Full-Text Index
Populate the Index

Saturday, September 13, 2008

textbox sum c#

double Subtotalincome =Convert.ToInt32(textBox1.Text) + Convert.ToInt32(textBox1.Text);

txtSubTotalNetIncome.Text = Subtotalincome.ToString();

Thursday, September 11, 2008

C# Insert Access sample with Newline constant

string connectionString = "provider=Microsoft.Jet.OLEDB.4.0;data source=c:\\sites\\database\\xxxxx.mdb";
OleDbConnection myOleDbConnection = new OleDbConnection(connectionString);
OleDbCommand myOleDbCommand = myOleDbConnection.CreateCommand();
string Strsql = "INSERT INTO CaseInfo(SERVICEID,PROPERTYSTATUS,BANK1NAME,BANK2NAME,TRUSTEENUMBER,TRUSTEESALEDATE,NOD,"
+ "TRAIL,[DATE],HORA,PROCESADORES,TELEMAR,closer)"
+ "VALUES (@SERVICEID,@PROPERTYSTATUS,@BANK1NAME,@BANK2NAME,@TRUSTEENUMBER,@TRUSTEESALEDATE,@NOD,@TRAIL,@DATE,@HORA"
+ "@PROCESADORES,@TELEMAR,@closer)";
OleDbConnection MyConn = new OleDbConnection(connectionString);
myOleDbCommand.CommandText = Strsql;
OleDbCommand cmd = new OleDbCommand(Strsql, MyConn);
cmd.Parameters.AddWithValue("@SERVICEID", DD_Service.SelectedItem.Value);
cmd.Parameters.AddWithValue("@PROPERTYSTATUS", DD_PropertyStatus.SelectedItem.Text);
cmd.Parameters.AddWithValue("@BANK1NAME", txtbank1.Text);
cmd.Parameters.AddWithValue("@BANK2NAME", txtbank2.Text);
cmd.Parameters.AddWithValue("@TRUSTEENUMBER", txtTrusteeSaleNo.Text);
cmd.Parameters.AddWithValue("@TRUSTEESALEDATE", txtTrusteeSaleDate.Text);
cmd.Parameters.AddWithValue("@NOD", txtnod.Text);
cmd.Parameters.AddWithValue("@TRAIL", TxtTrail1.Text);
cmd.Parameters.AddWithValue("@DATE", txtDate.Text);
cmd.Parameters.AddWithValue("@HORA", txtTime.Text);
cmd.Parameters.AddWithValue("@PROCESADORES", DD_PROCESADOR.SelectedItem.Text);
cmd.Parameters.AddWithValue("@TELEMAR", DD_Telemarketing.SelectedItem.Text);
cmd.Parameters.AddWithValue("@closer", DD_Closer.SelectedItem.Text);
MyConn.Open();
cmd.ExecuteNonQuery();
MyConn.Close();

Postback C# statement

if (Page.IsPostBack)
{
}

Get DropDownList C# value and Text

Get DropDownList C# Get value and Text

For Text:- Dropdownlist1.SelectedItem.Text
For Value:- DD_Dropdownlist1.SelectedItem.Value

Wednesday, September 10, 2008

DropDownList Add a first constant line asp.net 2.0

DropDownList Add a first constant line asp.net 2.0

DataTextField="NOMBRE" DataValueField="NOMBRE" AppendDataBoundItems="true">
You Hard coded value



SelectCommand="SELECT * FROM [REP]">

Tuesday, September 9, 2008

Login Authentication Access Database ado.net C# Sample

Sample Login Authentication using Access Database ado.net C# asp.net 2.0.

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;

public partial class userLogin : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
bool Authenticated = false;
Authenticated = SiteLevelCustomAuthenticationMethod(Login1.UserName, Login1.Password);
e.Authenticated = Authenticated;
if (Authenticated == true)
{
// Response.Redirect("Default.aspx");
}

}
private bool SiteLevelCustomAuthenticationMethod(string UserName, string Password)
{
OleDbConnection conDatabase = null;
OleDbDataReader Dr = null;

bool boolReturnValue = false;
string strUserID = UserName;
conDatabase = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\\sites\\user.mdb");
conDatabase.Open();

string strSQL = "select * from USERS where USERID=\'" + (strUserID + "\'");

OleDbCommand cmdDatabase = new OleDbCommand(strSQL, conDatabase);
Dr = cmdDatabase.ExecuteReader();

while (Dr.Read())
{
string UserNameDB = Dr["USERID"].ToString();
string PasswordDB = Dr["PASSWORD"].ToString();

if ((UserName == UserNameDB.TrimEnd().TrimStart()) & (Password == PasswordDB.TrimEnd().TrimStart()))
{
Session["loginm"] = strUserID;
boolReturnValue = true;
break;

}
}

Dr.Close();
return boolReturnValue;
}


}

Access Database with ADO.NET Connection

Walkthrough: Editing an Access Database with ADO.NET

using System.Data.OleDb;
private void ReadRecords()
{
OleDbConnection conn = null;
OleDbDataReader reader = null;
try
{
conn = new OleDbConnection(
"Provider=Microsoft.Jet.OLEDB.4.0; " +
"Data Source=" + Server.MapPath("Pets/Pets.mdb"));
conn.Open();
OleDbCommand cmd =
new OleDbCommand("Select * FROM PetTable", conn);
reader = cmd.ExecuteReader();
datagrid.DataSource = reader;
datagrid.DataBind();
}
// catch (Exception e)
// {
// Response.Write(e.Message);
// Response.End();
// }
finally
{
if (reader != null) reader.Close();
if (conn != null) conn.Close();
}
}

Saturday, September 6, 2008

Link connect Access Database with SQL-Server 2005

Link access database with sql server and run sql statment on sql-server

exec sp_addlinkedserver @server='AccessDb1',
@srvproduct='Access',
@provider='Microsoft.Jet.OLEDB.4.0',
@datasrc='C:\data\Categories_Products_Link.mdb'
exec sp_addlinkedsrvlogin @rmtsrvname='AccessDb',
@useself='false',
@rmtuser='Admin',
@rmtpassword=''

Friday, September 5, 2008

Asp.net menu control not working on Google Chrome

Solution
Put following code in your page load event.

if (Request.UserAgent.IndexOf("AppleWebKit") > 0)
{
Request.Browser.Adapters.Clear();
}

Gridview to excel C# Getting Error "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding."

in web.config add inside <system.web >

< httpRuntime maxRequestLength="2097151" executionTimeout="3600" />

Error "Control 'GridView1' of type 'GridView' must be placed inside a form tag with runat=server."

Solution
Put following in your code

public override void VerifyRenderingInServerForm(Control control)
{
/* Confirms that an HtmlForm control is rendered for the specified ASP.NET server control at run time. */
}

Tuesday, September 2, 2008

ToShortDateString mm/dd/yyyy format C#

instead of using ToShortDateString use this -

string

UpDated=DateTime.Now.ToString("MM/dd/yyyy");
--

MYSQL INSERT statement C# ASP.NET

MYSQL INSERT statement C# ASP.NET With Identity coulnm
strSQL1 = "insert SalesLeads(Fname, Lname , Address , Zip , Dphone , Ephone , EmailID , UpDated) values ('" + fname.Text + "','" + lname.Text + "','" + Address.Text + "','" + zip.Text + "','" + dphone.Text + "', '" + ephone.Text + "', '" + emailid.Text + "', '" + UpDated + "' );";