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!
Sunday, July 8, 2018
Saturday, July 7, 2018
Edit Items from SQL Table ASP.NET C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;
public partial class userListEdit : System.Web.UI.Page
{
Int32 countRec;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Button8.Visible = false;
Button9.Visible = false;
Label11116.Visible = false;
Button5.Visible = true;
Button6.Visible = true;
Button7.Visible = true;
if (Request["type"]== "E")
{
UserListloaddata();
}
else
{
Label11113.Visible = false;
TBId.Visible = false;
Button7.Visible = false;
Button10.Visible = false;
}
}
}
void UserListloaddata()
{
string strSQL;
SqlConnection myConnection = new SqlConnection(ConnectionString);
strSQL = "select * FROM tblMM_User_List WHERE MM_ID=" + Request["ID"];
SqlCommand cmd = new SqlCommand(strSQL, myConnection);
myConnection.Open();
SqlDataReader myReader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
while (myReader.Read())
{
TBId.Text = myReader["MM_ID"].ToString();
TBUserId.Text = myReader["MM_UserID"].ToString();
TBUserFnam.Text = myReader["MM_User_First"].ToString();
TBUserLname.Text = myReader["MM_User_Last"].ToString();
TBSecode.Text = myReader["MM_Sec_Code"].ToString();
DDTBSecTyp.SelectedItem.Text = myReader["MM_Type"].ToString();
TBTicNo.Text = myReader["MM_TicketNo"].ToString();
TBTicDT.Text = myReader["MM_TicketDate"].ToString();
TBDtSubmit.Text = myReader["MM_DtSubmtLegal"].ToString();
TBDateLegal.Text = myReader["MM_DtAddLegal"].ToString();
TBComm.Text = myReader["MM_Comment"].ToString();
}
myReader.Close();
myConnection.Close();
}
void updateMemo()
{
//Response.Write(DDTBSecTyp.SelectedItem.Text);
//Response.End();
SqlConnection myConnection = new SqlConnection(ConnectionString);
string strSQL;
strSQL = "update tblMM_User_List set MM_UserID=@MM_UserID,MM_User_First=@MM_User_First,MM_User_Last=@MM_User_Last,MM_Sec_Code=@MM_Sec_Code,MM_Type=@MM_Type,MM_TicketNo=@MM_TicketNo,"
+ "MM_TicketDate=@MM_TicketDate,MM_DtSubmtLegal=@MM_DtSubmtLegal,MM_DtAddLegal=@MM_DtAddLegal,MM_Comment=@MM_Comment,MM_UpdDate=@MM_UpdDate"
+ " WHERE MM_Id =" + Request["ID"];
SqlCommand cmd = new SqlCommand(strSQL, myConnection);
cmd.Parameters.AddWithValue("@MM_UserID" , TBUserId.Text);
cmd.Parameters.AddWithValue("@MM_User_First", TBUserFnam.Text);
cmd.Parameters.AddWithValue("@MM_User_Last",TBUserLname.Text);
cmd.Parameters.AddWithValue("@MM_Sec_Code", TBSecode.Text);
cmd.Parameters.AddWithValue("@MM_Type", DDTBSecTyp.SelectedItem.Text);
cmd.Parameters.AddWithValue("@MM_TicketNo",TBTicNo.Text);
cmd.Parameters.AddWithValue("@MM_TicketDate",TBTicDT.Text);
cmd.Parameters.AddWithValue("@MM_DtSubmtLegal",TBDtSubmit.Text) ;
cmd.Parameters.AddWithValue("@MM_DtAddLegal",TBDateLegal.Text);
cmd.Parameters.AddWithValue("@MM_Comment",TBComm.Text);
cmd.Parameters.AddWithValue("@MM_UpdDate", DateTime.Today.ToShortDateString());
myConnection.Open();
cmd.ExecuteNonQuery();
myConnection.Close();
}
void insertUserlist()
{
//Response.Write(DDTBSecTyp.SelectedItem.Text);
//Response.End();
SqlConnection myConnection = new SqlConnection(ConnectionString);
string strSQL;
strSQL = "insert into tblMM_User_List(MM_UserID,MM_User_First,MM_User_Last,MM_Sec_Code,MM_Type,MM_TicketNo,MM_TicketDate,MM_DtSubmtLegal,MM_DtAddLegal,MM_Comment,MM_UpdDate)values"
+ "(@MM_UserID,@MM_User_First,@MM_User_Last,@MM_Sec_Code,@MM_Type,@MM_TicketNo,@MM_TicketDate,@MM_DtSubmtLegal,@MM_DtAddLegal,@MM_Comment,@MM_UpdDate)";
SqlCommand cmd = new SqlCommand(strSQL, myConnection);
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@MM_UserID", TBUserId.Text);
cmd.Parameters.AddWithValue("@MM_User_First", TBUserFnam.Text);
cmd.Parameters.AddWithValue("@MM_User_Last", TBUserLname.Text);
cmd.Parameters.AddWithValue("@MM_Sec_Code", TBSecode.Text);
cmd.Parameters.AddWithValue("@MM_Type", DDTBSecTyp.SelectedItem.Text);
cmd.Parameters.AddWithValue("@MM_TicketNo", TBTicNo.Text);
cmd.Parameters.AddWithValue("@MM_TicketDate", TBTicDT.Text);
cmd.Parameters.AddWithValue("@MM_DtSubmtLegal", TBDtSubmit.Text);
cmd.Parameters.AddWithValue("@MM_DtAddLegal", TBDateLegal.Text);
cmd.Parameters.AddWithValue("@MM_Comment", TBComm.Text);
cmd.Parameters.AddWithValue("@MM_UpdDate", DateTime.Today.ToShortDateString());
myConnection.Open();
cmd.ExecuteNonQuery();
myConnection.Close();
}
protected void Button5_Click(object sender, EventArgs e)
{
if (Request["type"].ToString() == "E")
{
updateMemo();
updateusersercurity();
Response.Redirect("userListM.aspx");
}
if (Request["type"].ToString() == "A")
{
if (countRec >= 1)
{
Label11117.Visible = true;
}
else
{
Countdupdata();
insertUserlist();
updateusersercurity();
Response.Redirect("userListM.aspx");
}
}
}
void Deletedata()
{
SqlConnection myConnection = new SqlConnection(ConnectionString);
string strSQL;
strSQL = "delete from tblMM_User_List WHERE MM_ID=" + Request["ID"];
SqlCommand cmd = new SqlCommand(strSQL, myConnection);
cmd.CommandType = CommandType.Text;
myConnection.Open();
cmd.ExecuteNonQuery();
myConnection.Close();
}
void Countdupdata()
{
SqlConnection myConnection = new SqlConnection(ConnectionString);
string strSQL;
strSQL = "SELECT COUNT(*) FROM tblMM_User_List where MM_UserID ='" + TBUserId.Text + "' and MM_Sec_Code='" + TBSecode.Text + "'";
myConnection.Open();
SqlCommand comm = new SqlCommand(strSQL, myConnection);
countRec = (Int32)comm.ExecuteScalar();
myConnection.Close();
}
protected void Button6_Click(object sender, EventArgs e)
{
Response.Redirect("userListM.aspx");
}
protected void Button8_Click(object sender, EventArgs e)
{
Deletedata();
updateusersercurity();
Response.Redirect("userListM.aspx");
}
protected void Button9_Click(object sender, EventArgs e)
{
Button8.Visible = false;
Button9.Visible = false;
Button10.Visible = false;
Label11116.Visible = false;
Button5.Visible = true;
Button6.Visible = true;
Button7.Visible = true;
}
protected void Button7_Click(object sender, EventArgs e)
{
Button8.Visible = true;
Button9.Visible = true;
Label11116.Visible = true;
Button10.Visible = false;
Button5.Visible = false;
Button6.Visible = false;
Button7.Visible = false;
}
protected void Button10_Click(object sender, EventArgs e)
{
Countdupdata();
if (countRec >= 1)
{
Label11117.Visible = true;
}
else
{
insertUserlist();
updateusersercurity();
Response.Redirect("userListM.aspx");
}
}
void updateusersercurity()
{
SqlConnection myConnection = new SqlConnection(ConnectionString);
string strSQL;
strSQL = "dbo.SP_MM_SecurityByUser '" + TBUserId.Text.Trim() + "'";
SqlCommand cmd = new SqlCommand(strSQL, myConnection);
cmd.CommandType = CommandType.Text;
myConnection.Open();
cmd.ExecuteNonQuery();
myConnection.Close();
Label11112.Visible = true;
}
private string ConnectionString
{
get
{
string connectionString = ConfigurationManager.ConnectionStrings["MMDB_PDConnectionString"].ConnectionString;
return connectionString;
}
}
}
--------------
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="userListEdit.aspx.cs" Inherits="userListEdit" %>
Text="User List Add/Modification ">
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;
public partial class userListEdit : System.Web.UI.Page
{
Int32 countRec;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Button8.Visible = false;
Button9.Visible = false;
Label11116.Visible = false;
Button5.Visible = true;
Button6.Visible = true;
Button7.Visible = true;
if (Request["type"]== "E")
{
UserListloaddata();
}
else
{
Label11113.Visible = false;
TBId.Visible = false;
Button7.Visible = false;
Button10.Visible = false;
}
}
}
void UserListloaddata()
{
string strSQL;
SqlConnection myConnection = new SqlConnection(ConnectionString);
strSQL = "select * FROM tblMM_User_List WHERE MM_ID=" + Request["ID"];
SqlCommand cmd = new SqlCommand(strSQL, myConnection);
myConnection.Open();
SqlDataReader myReader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
while (myReader.Read())
{
TBId.Text = myReader["MM_ID"].ToString();
TBUserId.Text = myReader["MM_UserID"].ToString();
TBUserFnam.Text = myReader["MM_User_First"].ToString();
TBUserLname.Text = myReader["MM_User_Last"].ToString();
TBSecode.Text = myReader["MM_Sec_Code"].ToString();
DDTBSecTyp.SelectedItem.Text = myReader["MM_Type"].ToString();
TBTicNo.Text = myReader["MM_TicketNo"].ToString();
TBTicDT.Text = myReader["MM_TicketDate"].ToString();
TBDtSubmit.Text = myReader["MM_DtSubmtLegal"].ToString();
TBDateLegal.Text = myReader["MM_DtAddLegal"].ToString();
TBComm.Text = myReader["MM_Comment"].ToString();
}
myReader.Close();
myConnection.Close();
}
void updateMemo()
{
//Response.Write(DDTBSecTyp.SelectedItem.Text);
//Response.End();
SqlConnection myConnection = new SqlConnection(ConnectionString);
string strSQL;
strSQL = "update tblMM_User_List set MM_UserID=@MM_UserID,MM_User_First=@MM_User_First,MM_User_Last=@MM_User_Last,MM_Sec_Code=@MM_Sec_Code,MM_Type=@MM_Type,MM_TicketNo=@MM_TicketNo,"
+ "MM_TicketDate=@MM_TicketDate,MM_DtSubmtLegal=@MM_DtSubmtLegal,MM_DtAddLegal=@MM_DtAddLegal,MM_Comment=@MM_Comment,MM_UpdDate=@MM_UpdDate"
+ " WHERE MM_Id =" + Request["ID"];
SqlCommand cmd = new SqlCommand(strSQL, myConnection);
cmd.Parameters.AddWithValue("@MM_UserID" , TBUserId.Text);
cmd.Parameters.AddWithValue("@MM_User_First", TBUserFnam.Text);
cmd.Parameters.AddWithValue("@MM_User_Last",TBUserLname.Text);
cmd.Parameters.AddWithValue("@MM_Sec_Code", TBSecode.Text);
cmd.Parameters.AddWithValue("@MM_Type", DDTBSecTyp.SelectedItem.Text);
cmd.Parameters.AddWithValue("@MM_TicketNo",TBTicNo.Text);
cmd.Parameters.AddWithValue("@MM_TicketDate",TBTicDT.Text);
cmd.Parameters.AddWithValue("@MM_DtSubmtLegal",TBDtSubmit.Text) ;
cmd.Parameters.AddWithValue("@MM_DtAddLegal",TBDateLegal.Text);
cmd.Parameters.AddWithValue("@MM_Comment",TBComm.Text);
cmd.Parameters.AddWithValue("@MM_UpdDate", DateTime.Today.ToShortDateString());
myConnection.Open();
cmd.ExecuteNonQuery();
myConnection.Close();
}
void insertUserlist()
{
//Response.Write(DDTBSecTyp.SelectedItem.Text);
//Response.End();
SqlConnection myConnection = new SqlConnection(ConnectionString);
string strSQL;
strSQL = "insert into tblMM_User_List(MM_UserID,MM_User_First,MM_User_Last,MM_Sec_Code,MM_Type,MM_TicketNo,MM_TicketDate,MM_DtSubmtLegal,MM_DtAddLegal,MM_Comment,MM_UpdDate)values"
+ "(@MM_UserID,@MM_User_First,@MM_User_Last,@MM_Sec_Code,@MM_Type,@MM_TicketNo,@MM_TicketDate,@MM_DtSubmtLegal,@MM_DtAddLegal,@MM_Comment,@MM_UpdDate)";
SqlCommand cmd = new SqlCommand(strSQL, myConnection);
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@MM_UserID", TBUserId.Text);
cmd.Parameters.AddWithValue("@MM_User_First", TBUserFnam.Text);
cmd.Parameters.AddWithValue("@MM_User_Last", TBUserLname.Text);
cmd.Parameters.AddWithValue("@MM_Sec_Code", TBSecode.Text);
cmd.Parameters.AddWithValue("@MM_Type", DDTBSecTyp.SelectedItem.Text);
cmd.Parameters.AddWithValue("@MM_TicketNo", TBTicNo.Text);
cmd.Parameters.AddWithValue("@MM_TicketDate", TBTicDT.Text);
cmd.Parameters.AddWithValue("@MM_DtSubmtLegal", TBDtSubmit.Text);
cmd.Parameters.AddWithValue("@MM_DtAddLegal", TBDateLegal.Text);
cmd.Parameters.AddWithValue("@MM_Comment", TBComm.Text);
cmd.Parameters.AddWithValue("@MM_UpdDate", DateTime.Today.ToShortDateString());
myConnection.Open();
cmd.ExecuteNonQuery();
myConnection.Close();
}
protected void Button5_Click(object sender, EventArgs e)
{
if (Request["type"].ToString() == "E")
{
updateMemo();
updateusersercurity();
Response.Redirect("userListM.aspx");
}
if (Request["type"].ToString() == "A")
{
if (countRec >= 1)
{
Label11117.Visible = true;
}
else
{
Countdupdata();
insertUserlist();
updateusersercurity();
Response.Redirect("userListM.aspx");
}
}
}
void Deletedata()
{
SqlConnection myConnection = new SqlConnection(ConnectionString);
string strSQL;
strSQL = "delete from tblMM_User_List WHERE MM_ID=" + Request["ID"];
SqlCommand cmd = new SqlCommand(strSQL, myConnection);
cmd.CommandType = CommandType.Text;
myConnection.Open();
cmd.ExecuteNonQuery();
myConnection.Close();
}
void Countdupdata()
{
SqlConnection myConnection = new SqlConnection(ConnectionString);
string strSQL;
strSQL = "SELECT COUNT(*) FROM tblMM_User_List where MM_UserID ='" + TBUserId.Text + "' and MM_Sec_Code='" + TBSecode.Text + "'";
myConnection.Open();
SqlCommand comm = new SqlCommand(strSQL, myConnection);
countRec = (Int32)comm.ExecuteScalar();
myConnection.Close();
}
protected void Button6_Click(object sender, EventArgs e)
{
Response.Redirect("userListM.aspx");
}
protected void Button8_Click(object sender, EventArgs e)
{
Deletedata();
updateusersercurity();
Response.Redirect("userListM.aspx");
}
protected void Button9_Click(object sender, EventArgs e)
{
Button8.Visible = false;
Button9.Visible = false;
Button10.Visible = false;
Label11116.Visible = false;
Button5.Visible = true;
Button6.Visible = true;
Button7.Visible = true;
}
protected void Button7_Click(object sender, EventArgs e)
{
Button8.Visible = true;
Button9.Visible = true;
Label11116.Visible = true;
Button10.Visible = false;
Button5.Visible = false;
Button6.Visible = false;
Button7.Visible = false;
}
protected void Button10_Click(object sender, EventArgs e)
{
Countdupdata();
if (countRec >= 1)
{
Label11117.Visible = true;
}
else
{
insertUserlist();
updateusersercurity();
Response.Redirect("userListM.aspx");
}
}
void updateusersercurity()
{
SqlConnection myConnection = new SqlConnection(ConnectionString);
string strSQL;
strSQL = "dbo.SP_MM_SecurityByUser '" + TBUserId.Text.Trim() + "'";
SqlCommand cmd = new SqlCommand(strSQL, myConnection);
cmd.CommandType = CommandType.Text;
myConnection.Open();
cmd.ExecuteNonQuery();
myConnection.Close();
Label11112.Visible = true;
}
private string ConnectionString
{
get
{
string connectionString = ConfigurationManager.ConnectionStrings["MMDB_PDConnectionString"].ConnectionString;
return connectionString;
}
}
}
--------------
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="userListEdit.aspx.cs" Inherits="userListEdit" %>
Thursday, June 28, 2018
JDE Sales Module Order to Cash and main tables
https://docs.google.com/presentation/d/1fI4yFMBgRwbvmvMBYzyhVY1jUIAjvduNh-s2F235h6s/edit?usp=sharing
Wednesday, June 27, 2018
JD Edwards Main Application and Process For Interview
JD Edwards Main Tables and Program By Modules
- Sales Order Processing
Tables
F4201 - Sales Order Header
F4211- Sales Order Details
Application
P4210 - Sales order Entry Application
P4205 Shipment Confirmation
UBE
R42520 Print Pickslip
R42565 Print Invoices
R42800 Sales Update
Activity Rules
- Purchase order module
F4301 - Purchase Order Header
F4311- Purchase Order Details
Application
P4310 - Purchase order Entry Application
R43500 -Print PO
Activity Rules
- Sales Order Processing
Tables
F4201 - Sales Order Header
F4211- Sales Order Details
Application
P4210 - Sales order Entry Application
P4205 Shipment Confirmation
UBE
R42520 Print Pickslip
R42565 Print Invoices
R42800 Sales Update
Activity Rules
- Purchase order module
F4301 - Purchase Order Header
F4311- Purchase Order Details
Application
P4310 - Purchase order Entry Application
R43500 -Print PO
Activity Rules
Monday, June 11, 2018
Monday, June 4, 2018
Find Duplicate Value in Array C# Asp.net
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
int[] test = { 3, 6, 8, 10, 2, 3 ,6 };
int count = 0;
// Random ranDuplicateChange;
for (int i = 0; i < test.Length; i++)
{
count = 0;
// Console.WriteLine(" {0} :: The current number is: {1} ", i, test[i]);
for (int j = 0; j < test.Length; j++)
{
if (test[i] == test[j])
{
count++;
if (count >= 2)
{
Response.Write ("Duplicate found: {0}"+ test[j] +"<BR>");
}
}
}
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
int[] test = { 3, 6, 8, 10, 2, 3 ,6 };
int count = 0;
// Random ranDuplicateChange;
for (int i = 0; i < test.Length; i++)
{
count = 0;
// Console.WriteLine(" {0} :: The current number is: {1} ", i, test[i]);
for (int j = 0; j < test.Length; j++)
{
if (test[i] == test[j])
{
count++;
if (count >= 2)
{
Response.Write ("Duplicate found: {0}"+ test[j] +"<BR>");
}
}
}
}
}
}
Wednesday, May 23, 2018
Sample Select Web page c# gridview
Sample Select Web page c# gridview
Default.aspx:
asp:GridView ID="GridView1" runat="server" CellPadding="4" ForeColor="#333333" DataKeyNames="BusinessEntityID"
GridLines="None" AutoGenerateColumns="False" AutoGenerateEditButton="True" AutoGenerateDeleteButton="True" DataSourceID="SqlDataSource1">
connection string
ConnectionString="<%$ ConnectionStrings:AdventureWorks2008R2ConnectionString %>"
UpdateCommand= "update Person_test set BusinessEntityID=@BusinessEntityID,FirstName=@FirstName,MiddleName=@MiddleName,LastName=@LastName WHERE BusinessEntityID=@BusinessEntityID"
DeleteCommand="Delete from Person_test where BusinessEntityID=@BusinessEntityID"
>
Default.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
SqlDataSource1.SelectCommand = "SELECT * FROM [Person_test]";
}
protected void Button1_Click(object sender, EventArgs e)
{
// SqlDataSource1.SelectCommand = "select * from Person_test where BusinessEntityID ='" + TextBox1.Text + "' or FirstName= '" + TextBox2.Text + "' or MiddleName= '" + TextBox3.Text + "' or LastName='" + TextBox4.Text + "'";
SqlDataSource1.SelectCommand = "Select * from Person_test where BusinessEntityID like '%" + TextBox1.Text + "%'or FirstName like '%" + TextBox2.Text + "%'or MiddleName like '%" + TextBox3.Text + "%'or LastName like '%" + TextBox4.Text + "%'";
}
protected void Button2_Click(object sender, EventArgs e)
{
SqlDataSource1.SelectCommand= "Insert into person_testshweta([BusinessEntityID],[FirstName],[MiddleName],[LastName]) select '"+TextBox1.Text+"','"+TextBox2.Text+"','"+TextBox3.Text+"','"+TextBox4.Text+"'";
}
}
Webconfig.aspx
providerName="System.Data.SqlClient" />
asp:GridView ID="GridView1" runat="server" CellPadding="4" ForeColor="#333333" DataKeyNames="BusinessEntityID"
GridLines="None" AutoGenerateColumns="False" AutoGenerateEditButton="True" AutoGenerateDeleteButton="True" DataSourceID="SqlDataSource1">
connection string
ConnectionString="<%$ ConnectionStrings:AdventureWorks2008R2ConnectionString %>"
UpdateCommand= "update Person_test set BusinessEntityID=@BusinessEntityID,FirstName=@FirstName,MiddleName=@MiddleName,LastName=@LastName WHERE BusinessEntityID=@BusinessEntityID"
DeleteCommand="Delete from Person_test where BusinessEntityID=@BusinessEntityID"
>
Default.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
SqlDataSource1.SelectCommand = "SELECT * FROM [Person_test]";
}
protected void Button1_Click(object sender, EventArgs e)
{
// SqlDataSource1.SelectCommand = "select * from Person_test where BusinessEntityID ='" + TextBox1.Text + "' or FirstName= '" + TextBox2.Text + "' or MiddleName= '" + TextBox3.Text + "' or LastName='" + TextBox4.Text + "'";
SqlDataSource1.SelectCommand = "Select * from Person_test where BusinessEntityID like '%" + TextBox1.Text + "%'or FirstName like '%" + TextBox2.Text + "%'or MiddleName like '%" + TextBox3.Text + "%'or LastName like '%" + TextBox4.Text + "%'";
}
protected void Button2_Click(object sender, EventArgs e)
{
SqlDataSource1.SelectCommand= "Insert into person_testshweta([BusinessEntityID],[FirstName],[MiddleName],[LastName]) select '"+TextBox1.Text+"','"+TextBox2.Text+"','"+TextBox3.Text+"','"+TextBox4.Text+"'";
}
}
Webconfig.aspx
providerName="System.Data.SqlClient" />
Sql command to create table
select BusinessEntityID,FirstName,LastName into Person_test from Person.Person
Tuesday, May 22, 2018
Excel data load in SQL Server table using OLEDB ,VBA
Sub test()
Dim cn As ADODB.Connection
Dim strSQL As String
Dim lngRecsAff As Long
Set cn = New ADODB.Connection
cn.Open "Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Data Source=" & Application.ActiveWorkbook.FullName & ";" & _
"Extended Properties=Excel 8.0"
'Import by using Jet Provider.
strSQL = "" & _
"" & _
" Insert into [odbc;Driver={SQL Server};" & _
"Server=SEVERSQL1;Database=Mydb;" & _
"UID=budget;PWD=Password].[ForecastUpdate1111] " & _
"SELECT * FROM [UpdateData$]"
' Debug.Print strSQL
cn.Execute strSQL, lngRecsAff, adExecuteNoRecords
'debug.print "Records affected: " & lngRecsAff
cn.Close
Set cn = Nothing
End Sub
Dim cn As ADODB.Connection
Dim strSQL As String
Dim lngRecsAff As Long
Set cn = New ADODB.Connection
cn.Open "Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Data Source=" & Application.ActiveWorkbook.FullName & ";" & _
"Extended Properties=Excel 8.0"
'Import by using Jet Provider.
strSQL = "" & _
"" & _
" Insert into [odbc;Driver={SQL Server};" & _
"Server=SEVERSQL1;Database=Mydb;" & _
"UID=budget;PWD=Password].[ForecastUpdate1111] " & _
"SELECT * FROM [UpdateData$]"
' Debug.Print strSQL
cn.Execute strSQL, lngRecsAff, adExecuteNoRecords
'debug.print "Records affected: " & lngRecsAff
cn.Close
Set cn = Nothing
End Sub
Sunday, May 13, 2018
Constructors in VB.NET
A constructor in VB.NET is defined as a procedure that has the name New (rather than Initialize as in VB 6.0) and can accept arguments to allow clients to pass data into the instance to assist with initialization. Constructors do not return values and therefore are always declared as a Sub.Mar 1, 2002
Thursday, May 10, 2018
Divide by Sum SQL Server same table join
Divide by Sum SQL Server same table join
select a.objsub,a.bu, a.period_01a, a.period_01a/sum(b.period_01a),sum(b.period_01a)FROM FORECAST_DATA a
left outer join FORECAST_DATA b on a.bu=b.bu and b.objsub like '9991%'
where left(a.objsub,2) in ('41','53','54','55','56')
--and a.bu='021000'
group by a.objsub, a.period_01a,a.bu
select a.objsub,a.bu, a.period_01a, a.period_01a/sum(b.period_01a),sum(b.period_01a)FROM FORECAST_DATA a
left outer join FORECAST_DATA b on a.bu=b.bu and b.objsub like '9991%'
where left(a.objsub,2) in ('41','53','54','55','56')
--and a.bu='021000'
group by a.objsub, a.period_01a,a.bu
having sum(b.period_01a)<>0
Parameter by Value and reference
C# program that demonstrates parameter passing
using System;
class Program
{
static void Main()
{
int val = 0;
Example1(val);
Console.WriteLine(val); // Still 0.
Example2(ref val);
Console.WriteLine(val); // Now 2.
Example3(out val);
Console.WriteLine(val); // Now 3.
}
static void Example1(int value)
{
value = 1;
}
static void Example2(ref int value)
{
value = 2;
}
static void Example3(out int value)
{
value = 3;
}
}
Output
0
2
3
Notes, Example 1. Example1 uses value-passing semantics for its declaration. Therefore, when it changes the value of its parameter int, that only affects the local state of the method.
Notes, Example 2. Example2 uses the ref modifier for its int parameter. This informs the compiler that a reference to the actual variable (int val) is to be passed to Example2.
Note:
The ref keyword is used in the calling syntax in Main. When Example2 sets its parameter to 2, this is reflected in the Main method.
Notes, Example 3. Example3 uses out on its parameter. This has compile-time checking features. These involve definite assignment rules.
Finally:
Example3 sets its parameter to 3—this is reflected in the calling location.
Ref, out. What is the difference between ref and out? The difference is in the compiler's application of the definite assignment analysis step.
Important:
The compiler demands that an out parameter be "definitely assigned" before any exit. There is no such restriction with the ref.
Wednesday, May 9, 2018
Saturday, May 5, 2018
Temporary table in PL/SQL, kind of Select into
create global temporary table temp_raj
on commit preserve rows
as
select * from raj.sal where 1=0
insert into temp_raj select * from raj.sal;
on commit preserve rows
as
select * from raj.sal where 1=0
insert into temp_raj select * from raj.sal;
Saturday, March 10, 2018
Insert C# SQL/Connection String
string strSQL1;
strSQL1 = " insert into [tblcontrol_Comt] ( [SLNO],[Status],[Reason]) select " + t1 + ",'" + DropDownList4.SelectedItem + "','" + TB_Comment.Text + "'";
strSQL = strSQL + strSQL1;
//Response.Write(strSQL);
//Response.End();
SqlCommand cmd = new SqlCommand(strSQL, myConnection);
cmd.CommandTimeout = 30000;
cmd.CommandType = CommandType.Text;
myConnection.Open();
cmd.ExecuteNonQuery();
myConnection.Close();
private string ConnectionString
{
get
{
string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString1"].ConnectionString;
return connectionString;
}
}
On Sat, Mar 10, 2018 at 10:42 PM, Rajeev Kumar <rajeevkum@gmail.com> wrote:
string strSQL1;strSQL1 = " insert into [tblcontrol_Comt] ( [SLNO],[Status],[Reason]) select " + t1 + ",'" + DropDownList4.SelectedItem + "','" + TB_Comment.Text + "'";strSQL = strSQL + strSQL1;//Response.Write(strSQL);//Response.End();SqlCommand cmd = new SqlCommand(strSQL, myConnection);cmd.CommandTimeout = 30000;cmd.CommandType = CommandType.Text;myConnection.Open();cmd.ExecuteNonQuery();myConnection.Close();
Rajeev Kumar
949-378-6094
949-378-6094
insert C# SQL
string strSQL1;
strSQL1 = " insert into [tblcontrol_Comt] ( [SLNO],[Status],[Reason]) select " + t1 + ",'" + DropDownList4.SelectedItem + "','" + TB_Comment.Text + "'";
strSQL = strSQL + strSQL1;
//Response.Write(strSQL);
//Response.End();
SqlCommand cmd = new SqlCommand(strSQL, myConnection);
cmd.CommandTimeout = 30000;
cmd.CommandType = CommandType.Text;
myConnection.Open();
cmd.ExecuteNonQuery();
myConnection.Close();
Subscribe to:
Posts (Atom)