This is my technical area for troubleshooting and learning new programming skills and much more. Here, you will find answers on a wide range of technologies such as AI, Machine Learning, OpenAI, Databricks, ASP.NET, C#, Python, Microsoft Access, MySQL, Amazon Web Services, SQL Server, PL/SQL, JD Edwards, SAS, Salesforce, APIs, MVC, and many others. Please feel free to visit and join the discussion!
Friday, June 18, 2010
What is Service Broker? Sql-server
Service Broker is a message‐queuing technology in SQL Server that allows developers to integrate SQL Server fully into distributed
applications. Service Broker is feature which provides facility to SQL Server to send an asynchronous, transactional message.
It allows a database to send a message to another database without waiting for the response,
So that application will continue to function if the remote database is temporarily unavailable.
Thursday, June 17, 2010
Wednesday, June 16, 2010
Security Configuration Wizard Windows server 2003
Security Configuration Wizard
The Security Configuration Wizard (SCW) is a new tool that is available with the installation of Windows Server 2003 Service Pack (SP)1. The SCW reduces the attack surface of Microsoft Windows 2003 Servers by guiding an authorized administrator through a series of questions designed to determine the functional requirements of a server. Any service functionality that is not required, by the roles being performed by the server, is then disabled. This provides greater security for the server by eliminating the potential of those services being used as an avenue of attack.
Tuesday, June 15, 2010
Can the JD Edwards Job Number be retrieved at runtime?
Wednesday, June 9, 2010
Load Checkbox from database asp.net 3.5 c# sql-server
Load Checkbox from database asp.net 3.5 c# sql-server
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="chkbx.aspx.cs" Inherits="chkbx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.style1
{
width: 25%;
}
</style>
</head>
<body text="dssdds">
<form id="form1" runat="server">
<div>
<table align="center" class="style1">
<tr>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
<asp:DropDownList ID="DropDownList1" runat="server"
DataSourceID="SqlDataSource1" DataTextField="co" DataValueField="co">
</asp:DropDownList>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Submit" />
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString1 %>"
SelectCommand="SELECT [co] FROM [boconn]"></asp:SqlDataSource>
</td>
<td>
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="CheckBox1" runat="server" Text="Media1" />
</td>
<td>
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="CheckBox2" runat="server" Text="Media1 Date" />
</td>
<td>
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="CheckBox3" runat="server" Text="Media3" />
</td>
<td>
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="CheckBox4" runat="server" Text="Media3 Date" />
</td>
<td>
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="CheckBox5" runat="server" Text="Boxes" />
</td>
<td>
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="CheckBox61" runat="server" Text="Cryosettes" />
</td>
<td>
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="CheckBox6" runat="server" Text="50ml Tubes" />
</td>
<td>
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="CheckBox7" runat="server" Text="Gel Packs" />
</td>
<td>
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="CheckBox8" runat="server" Text="Media Labels" />
</td>
<td>
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="CheckBox9" runat="server" Text="Procurment Forms" />
</td>
<td>
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="CheckBox10" runat="server" Text="Consent Forms" />
</td>
<td>
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="CheckBox11" runat="server" Text="Last LN2 fill" />
</td>
<td>
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="CheckBox12" runat="server" Text="Next LN2 fill" />
</td>
<td>
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="CheckBox13" runat="server" Text="Fedex Forms" />
</td>
<td>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
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.SqlClient;
public partial class chkbx : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
CheckBox1.Checked =false;
CheckBox2.Checked = false;
CheckBox3.Checked = false;
CheckBox4.Checked = false;
CheckBox5.Checked = false;
CheckBox6.Checked = false;
CheckBox61.Checked = false;
CheckBox7.Checked = false;
CheckBox8.Checked = false;
CheckBox9.Checked = false;
CheckBox10.Checked = false;
CheckBox11.Checked = false;
CheckBox12.Checked = false;
CheckBox13.Checked = false;
//Load Data
loadchkdata();
}
void loadchkdata()
{
string strSQL;
SqlConnection myConnection = new SqlConnection(ConnectionString);
strSQL = "select * FROM BOVBFL WHERE VBFLT='" + DropDownList1.SelectedItem.Text +"'";
SqlCommand cmd = new SqlCommand(strSQL, myConnection);
myConnection.Open();
SqlDataReader myReader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
while (myReader.Read())
{
if (myReader["VBROWS"].ToString() == "media1tr")
{
CheckBox1.Checked = true;
}
if (myReader["VBROWS"].ToString() == "media1datetr")
{
CheckBox2.Checked = true;
}
if (myReader["VBROWS"].ToString() == "Media3")
{
CheckBox3.Checked = true;
}
if (myReader["VBROWS"].ToString() == "media3datetr")
{
CheckBox4.Checked = true;
}
if (myReader["VBROWS"].ToString() == "Boxestr")
{
CheckBox5.Checked = true;
}
if (myReader["VBROWS"].ToString() == "Cryosettes")
{
CheckBox61.Checked = true;
}
if (myReader["VBROWS"].ToString() == "qutytr")
{
CheckBox6.Checked = true;
}
if (myReader["VBROWS"].ToString() == "GelPackstr")
{
CheckBox7.Checked = true;
}
if (myReader["VBROWS"].ToString() == "mediaTr")
{
CheckBox8.Checked = true;
}
if (myReader["VBROWS"].ToString() == "Procurmenttr")
{
CheckBox9.Checked = true;
}
if (myReader["VBROWS"].ToString() == "Consenttr")
{
CheckBox10.Checked = true;
}
if (myReader["VBROWS"].ToString() == "Fedextr")
{
CheckBox13.Checked = true;
}
if (myReader["VBROWS"].ToString() == "lnfilltr")
{
CheckBox11.Checked = true;
}
if (myReader["VBROWS"].ToString() == "shipfozenstr")
{
CheckBox12.Checked = true;
}
}
myReader.Close();
myConnection.Close();
}
private string ConnectionString
{
get
{
string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString1"].ConnectionString;
return connectionString;
}
}
}
Friday, June 4, 2010
Hide AutoGenerateDeleteButton
Create your countdown clock using asp.net ,ajax,c#
Date time calculation , Create your countdown clock using asp.net ,ajax,c#, format TimeSpan etc.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="cloc.aspx.cs" Inherits="cloc" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript" language="JavaScript">
function DisplayDynamicClock()
{
setInterval("__doPostBack('upDynamicClock', '');", 1000);
}
window.onload = DisplayDynamicClock;
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="smDynamicClock" runat="server" />
<div style="font-family: Trebuchet MS;">
<asp:UpdatePanel runat="server" ID="upDynamicClock" >
<ContentTemplate>
<strong>Current Date and Time is:</strong>
<asp:Label ForeColor="Red" runat="server" ID="lblDynamicClock" />
<br />
<asp:Label ID="Label2" runat="server" Text="Compare To:"></asp:Label>
<asp:TextBox ID="TextBox2" runat="server">5/4/2010 11:01:25 AM</asp:TextBox>
<br />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class cloc : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
DateTime fdat;
lblDynamicClock.Text = DateTime.Now.ToString();
fdat = Convert.ToDateTime(TextBox2.Text);
DateTime dt1 = DateTime.Now;
DateTime dt2 = Convert.ToDateTime(TextBox2.Text);
TimeSpan ts = dt1.Subtract(dt2);
Label1.Text = "Days:-" + (int)ts.Days + "<br/>Hours:-" + (int)ts.Hours + "<br/>Mins:-" + (int)ts.Minutes + "<br/>Seconds:-" + ts.Seconds;
}
}
Thursday, June 3, 2010
Upload file to server from webpage using C# asp.net 3.5
Upload file to server from webpage using C# asp.net 3.5
The folder you want to upload you have to have permmission to read/write
using System;
using System.Data;
using System.Configuration;
using System.Collections;
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="uploadfile.aspx.cs" Inherits="uploadfile" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table style="width:50%;" align="center">
<tr>
<td>
</td>
<td align="center">
<br />
<br />
<asp:Label ID="Label2" runat="server"></asp:Label></td>
</tr>
<tr>
<td align="right" valign="top">
<asp:Label ID="Label3" runat="server" Text="Select a File to Upload:"></asp:Label>
</td>
<td align="left" >
<asp:FileUpLoad id="FileUpLoad1" runat="server" Height="24px" Width="209px" />
<br />
</td>
</tr>
<tr>
<td align="right" valign="top">
<asp:Label ID="Label4" runat="server" Text="File Description:"></asp:Label>
</td>
<td align="left" >
<asp:TextBox ID="TextBox1" runat="server" Width="120px"></asp:TextBox>
<asp:Button id="UploadBtn" Text="Upload File" OnClick="UploadBtn_Click"
runat="server" Width="78px" />
</td>
</tr>
<tr>
<td align="right" valign="top"> </td>
<td align="center" >
<asp:Label ID="Label1" runat="server" Width="416px"></asp:Label></td>
</tr>
</table>
<table style="width: 81%; " align="center">
<tr>
<td>
</td>
<td align="center" >
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
CellPadding="4" DataSourceID="SqlDataSource1" DataKeyNames="FLID"
ForeColor="#333333" GridLines="None" AutoGenerateDeleteButton="true">
<RowStyle BackColor="#EFF3FB" />
<Columns>
<asp:BoundField DataField="FLID" HeaderText="Id"
SortExpression="FLID" />
<asp:BoundField DataField="FLDESC" HeaderText="Description"
SortExpression="FLDESC" />
<asp:BoundField DataField="FLFOLDER" HeaderText="Folder"
SortExpression="FLFOLDER" Visible="false"/>
<asp:BoundField DataField="FLNAME" HeaderText="Name"
SortExpression="FLNAME" />
<asp:BoundField DataField="FLTYPE" HeaderText="Type"
SortExpression="FLTYPE" />
<asp:BoundField DataField="FLDATCR" HeaderText="Date"
SortExpression="FLDATCR" />
<asp:BoundField DataField="FLCO" HeaderText="CO"
SortExpression="FLCO" />
<asp:HyperLinkField DataNavigateUrlFields="FLNAME" DataNavigateUrlFormatString="files/{0}" DataTextField="FLNAME" HeaderText="Download " />
</Columns>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#2461BF" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:JDE_RKConnectionString3 %>"
DeleteCommand="delete FROM [BOFLUPD] where FLID=@FLID" >
<SelectParameters>
<asp:SessionParameter Name="FLCO" SessionField="Usrcop" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<br />
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
</tr>
</table>
</asp:Content>
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.SqlClient;
using System.IO;
using System.Data.Common;
public partial class uploadfile : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["Usrcop"].ToString() == "ALL")
{
SqlDataSource1.SelectCommand = "SELECT * FROM BOFLUPD";
}
else
{
SqlDataSource1.SelectCommand = "SELECT * FROM BOFLUPD WHERE FLCO='" + Session["Usrcop"].ToString() + "'";
}
}
protected void UploadBtn_Click(object sender, EventArgs e)
{
if (FileUpLoad1.HasFile)
{
string filePath = FileUpLoad1.PostedFile.FileName;
string FileType = FileUpLoad1.PostedFile.ContentType;
//FileUpLoad1.SaveAs(@"C:\\sites\\Single15\\visli\\database\\files\\" + FileUpLoad1.FileName);
string fn = System.IO.Path.GetFileName(FileUpLoad1.PostedFile.FileName);
string SaveLocation = Server.MapPath("files") + "\\" + fn;
try
{
FileUpLoad1.PostedFile.SaveAs(SaveLocation);
// "F"+"-"+DateTime.Now.ToShortTimeString()+"-"+
Label1.Text = "The file has been uploaded.";
insFileName(FileUpLoad1.FileName, FileType);
}
catch (Exception ex)
{
Response.Write("Error: " + ex.Message);
//Note: Exception.Message returns a detailed message that describes the current exception.
//For security reasons, we do not recommend that you return Exception.Message to end users in
//production environments. It would be better to put a generic error message.
}
}
}
void insFileName(string FileName, string FileType)
{
SqlConnection myConnection = new SqlConnection(ConnectionString);
string strSQL;
string FileFolder = "http://localhost/bioprj/files/" + FileName;
strSQL = "insert into BOFLUPD(FLFOLDER,FLNAME,FLTYPE,FLDATCR,FLDESC,FLCO)values(@FLFOLDER,@FLNAME,@FLTYPE,@FLDATCR,@FLDESC,@FLCO)";
SqlCommand cmd = new SqlCommand(strSQL, myConnection);
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@FLFOLDER", FileFolder);
cmd.Parameters.AddWithValue("@FLNAME", FileName);
cmd.Parameters.AddWithValue("@FLTYPE", FileType);
cmd.Parameters.AddWithValue("@FLDATCR", DateTime.Now.ToShortDateString());
cmd.Parameters.AddWithValue("@FLDESC", TextBox1.Text);
cmd.Parameters.AddWithValue("@FLCO", Session["Usrcop"].ToString());
myConnection.Open();
cmd.ExecuteNonQuery();
myConnection.Close();
Label1.Text = "Added..";
Response.Redirect("uploadfile.aspx");
}
private string ConnectionString
{
get
{
string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString1"].ConnectionString;
return connectionString;
}
}
}
Thursday, May 27, 2010
Tuesday, May 18, 2010
Monday, May 17, 2010
Working code for facebook new api login and stream publish C#
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<head id="Head1" runat="server">
<title></title>
<script language=javascript>
function connectLogin() {
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm._doPostBack('UpdatePanel1', '');
}
setTimeout("connectLogin()", 10000);
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" />
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="lblStatus" runat="server" Text="Label"></asp:Label>
<asp:Literal ID="connectLoginControl" runat=server><fb:login-button onlogin=connectLogin() ></fb:login-button></asp:Literal>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
<script type="text/javascript" src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php"></script>
<script type="text/javascript">
FB.init("Your Api", "xd_receiver.htm");
</script>
<input id="Button2" type="button" value="button" onclick=connectLogin() />
</body>
</html>
Code Behind
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Facebook.Rest;
using Facebook.Schema;
using Facebook.Session;
using Facebook.Utility;
using Facebook;
using Facebook.Session.DesktopPopup;
public partial class Default2 : System.Web.UI.Page
{
private const string APPLICATION_KEY = "you Api Key";
private const string SECRET_KEY = "Your secret";
private Api _facebookAPI;
// private List<EventUser> _eventUsers;
//private ConnectSession _connectSession;
private Facebook.Rest.Api Api;
private Facebook.Session.ConnectSession connectSession;
protected void Page_Load(object sender, EventArgs e)
{
// Response.Redirect("http://www.facebook.com/login.php?api_key=you Api Key&connect_display=popup&v=1.0&next=http://www.facebook.com/connect/login_success.html&cancel_url=http://www.facebook.com/connect/login_failure.html&fbconnect=true&return_session=true&req_perms=offline_access");
connectSession = new Facebook.Session.ConnectSession(APPLICATION_KEY, SECRET_KEY);
if (!connectSession.IsConnected())
{
lblStatus.Text = "Please sign-in with Facebook." + DateTime.Now.ToString();
}
else
{
Api = new Facebook.Rest.Api(connectSession);
Facebook.Schema.user u = Api.Users.GetInfo();
Session["facebook_userId"] = Api.Session.UserId;
lblStatus.Text = string.Format("Welcome, " + u.name +" :-" +Session["facebook_userId"]);
bool hasPublishStream = Api.Users.HasAppPermission(Enums.ExtendedPermissions.publish_stream, Convert.ToInt64(Api.Users.GetLoggedInUser()));
bool hasOffline = Api.Users.HasAppPermission(Enums.ExtendedPermissions.offline_access, Convert.ToInt64(Api.Users.GetLoggedInUser()));
Response.Write("test permission "+hasPublishStream);
//Api.Stream.Publish("Test Messages", null, null, null, Api.Users.GetLoggedInUser());
Api.Stream.Publish("Test Messages", null, null, Api.Users.GetLoggedInUser().ToString(),0);
connectLoginControl.Visible = false;
}
}
}