sonia sardana -13 Posting Whiz

My tnsNames.Ora File -

XE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = Sonia-PC)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = XE)
    )
  )

EXTPROC_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    )
    (CONNECT_DATA =
      (SID = PLSExtProc)
      (PRESENTATION = RO)
    )
  )

ORACLR_CONNECTION_DATA = 
  (DESCRIPTION = 
    (ADDRESS_LIST = 
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1)) 
    ) 
    (CONNECT_DATA = 
      (SID = CLRExtProc) 
      (PRESENTATION = RO) 
    ) 
  ) 

.Net Code -

public partial class Default2 : System.Web.UI.Page
{

    OracleCommand cmd = new OracleCommand();
    OracleConnection conn = new OracleConnection("Data Source=(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = Sonia-PC)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE))),UserID=user_test,Password=sonia;");

    protected void Page_Load(object sender, EventArgs e)
    {
        cmd.CommandText = "INSERTSTUDENT";
        cmd.Connection = conn;
        cmd.Parameters.Add("p_roll", OracleDbType.Long, 64, 1, ParameterDirection.Input);
        cmd.Parameters.Add("p_name", OracleDbType.Varchar2, 2000, "sonia", ParameterDirection.Input);
        cmd.Parameters.Add("p_marks", OracleDbType.Long, 64, "10", ParameterDirection.Input);
        conn.Open();
        cmd.ExecuteNonQuery();
    }
}
`

When the line conn.Open() is executed ERROR is dere -** *ORA-12154: TNS:could not resolve the connect identifier specified* ** My SQL Developer is connected with ORACLE. There is no error in Oracle Set Up.

I have set Data Source = XE also but it also giving the same ERROR.``

sonia sardana -13 Posting Whiz

I have installed the Oracle 10g at the following location : -
C:\oracle\product\10.2.0\client_1\NETWORK\ADMIN

But I was trying to ping Oracle Client from Command Prompt. See Below : -
c:\Oracle>tnsping SONIA
ERROR IS COMING no listener

MINE tnsnames.ora File : -

# tnsnames.ora Network Configuration File: C:\oracle\product\10.2.0\client_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.

SONIA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = sonia)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = SONIA)
    )
  )

What this error means??? Help me in connecting to the ORACLE 10g.
I have studied on the net that for Oracle to connect three ora files need to be there. But in my ADMIN Folder two files are created by Oracle Configuration Tools names SqlNet.ORA , TNSNAMES.ORA. LISTENER.ORA file is not created.

sonia sardana -13 Posting Whiz

I want to convert the following SP to SQL, but I am not able to do ::-

ORACLE SP

create or replace
PROCEDURE           "USP_TEST" 
(
p_CURPRODUCTTYPE out sys_refcursor,
p_PROD_ID IN TBL_PROD_MASTER.PROD_ID%TYPE :=NULL
) is
  begin
  open p_CURPRODUCTTYPE for
SELECT PROD_ID,
  PROD_CODE,
  PROD_NAME,
  PRIMARY_UOM,
  SECONDARY_UOM
FROM TBL_PROD_MASTER
WHERE TBL_PROD_MASTER.PROD_ID =NVL(p_PROD_ID,TBL_PROD_MASTER.PROD_ID)
ORDER BY TBL_PROD_MASTER.PROD_NAME;
end;

SQL SP : -

CREATE PROCEDURE "USP_TEST"(p_recordset OUT SYS_REFCURSOR , 
p_PROD_ID IN TBL_PROD_MASTER.PROD_ID%TYPE :=NULL
                      ) AS 
BEGIN 
  OPEN p_recordset FOR
   SELECT PROD_ID,
  PROD_CODE,
  PROD_NAME,
  PRIMARY_UOM,
  SECONDARY_UOM
FROM TBL_PROD_MASTER
WHERE TBL_PROD_MASTER.PROD_ID =NVL(p_PROD_ID,TBL_PROD_MASTER.PROD_ID)
ORDER BY TBL_PROD_MASTER.PROD_NAME; 

END ;
/

But I am getting the following ERRORs : -
Msg 102, Level 15, State 1, Procedure USP_TEST, Line 1
Incorrect syntax near 'p_recordset'.
Msg 156, Level 15, State 1, Procedure USP_TEST, Line 5
Incorrect syntax near the keyword 'FOR'.
Msg 195, Level 15, State 10, Procedure USP_TEST, Line 12
'NVL' is not a recognized built-in function name.

sonia sardana -13 Posting Whiz

hello sknake,no interviewing is not my hobby.

In every interview ,I faced new questions or may be questions seems to me new cz i m not so intelligent.

So wat to do,to know the answers only forums are my best frnd!!!!!!!!!!!!!!!!!

sonia sardana -13 Posting Whiz

Hey frnds plz reply of mine questions.I want to just confirm my answers.Plz reply it by today only if poss.bz tom is my another interview

1) How to Delete Dynamically Allocated Array?
a) delete a[]
b)delete a[0]
c) delete[] a
d)delete [0] a

My answer a.Correct or not

2)Can we use DML statement in function?
a)Yes
b)No
c)Temp tables
d)None

My answer d.Correct or not

3)Confusion
Hey friends I read somewhere the diff b/w stored proc & functions?
One of them is
Stored Procedure returns more than one value whereas functions return single value.

When the interviwer ask me the question,i asnwered includg my above point,but he told me no SProc do no return any value.
Please Clarify It.

4)Can we return value from SPROC?
a)No
b)Using O/p Parameters
c)Using return statement
d)B & C Both

ANSWER---??

5)Views are complied or not
a)Yes
b)No
c)Partially Compiled
d)None

ANSWER---??

6)Can we user specific data in application?
My answer no.Me correct

7)Diff b/w primary key & UNIQUE key excepts one diff primary doesn't allow NULLS whereas unique does.
One diff i told
we can craete only one primary key for a table,whereas a table can have more than one unique key.
ANy more differences?????

8) Can we call a fn. widout dbo?
I ans NO. …

sonia sardana -13 Posting Whiz

hi frnds ,I started a new project in .Net 3.5 version.I add a New Ajax Web Form Default2.aspx.

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

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

    }
}

I run PROJECT & it runs successfully.

Now i add webservice. It contains the WebService.cs in app_code folder.
WebService.cs

using System;
using System.Collections;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;

/// <summary>
/// Summary description for WebService
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
// [System.Web.Script.Services.ScriptService]
public class WebService : System.Web.Services.WebService {

    public WebService () {

        //Uncomment the following line if using designed components 
        //InitializeComponent(); 
    }

    [WebMethod]
    public string HelloWorld() {
        return "Hello World";
    }
    
}

I run PROJECT & it runs successfully.

Now i drag AutoCompleteExtender on the form Default2.aspx. It contains error
Unknown server tag 'asp:AutoCompleteExtender'

Why the error is coming??Plz help me in sorting out! hi frnds help me.

sonia sardana -13 Posting Whiz
<connectionStrings>
    <add name="ConnectionString" connectionString="Data Source=(local);Initial catalog=sonia;User ID=sonia;Password=sonia;" providerName="System.Data.SqlClient"/>
  </connectionStrings>
public partial class Frmgrid : System.Web.UI.Page
{
    SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
    SqlDataAdapter da;
    DataSet ds;

    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            da = new SqlDataAdapter("SELECT * FROM Products", conn);
            da.Fill(ds, "tb1");
            DropDownList1.DataSource = ds.Tables["tb1"];
            DropDownList1.DataBind();
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message.ToString());
        }
    }        
}

ERROR is dere while executing the line da.Fill(ds, "tb1");
"Value cannot be null.\r\nParameter name: dataSet"

sonia sardana -13 Posting Whiz
protected void btnLogin_Click(object sender, EventArgs e)
    {
        try
        {
            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
            SqlCommand cmd = new SqlCommand("SELECT * FROM UserLogin", conn);
            conn.Open();
            SqlDataReader dr = cmd.ExecuteReader();
            while (dr.Read())
            {
                if (txtUserName.Text == dr[0].ToString())
                {
                    if (txtPassword.Text == dr[1].ToString())
                    {
                        Response.Redirect("FrmLogin.aspx");
                    }
                    else
                    {
                        lblError.Text = "UserName & Password do not match";
                    }
                }
                else
                {
                    lblError.Text = "UserName & Password do not match";
                }
            }
        }

        catch (Exception ex)
        {
            Response.Write(ex.Message.ToString());
        }
    }

I call user control in Frmlogin.aspx page. First time i run the form,it runs.Now when i runs the Frmlogin.aspx page error is there
Disassembly cannot be displayed. The expression has not yet been translated to native machine code.

Wats dis error means?Can u tell me?

sonia sardana -13 Posting Whiz

Hey frnds tell me to see ASP.net site video tutorials,is it necessary that msdn sites will open up. Because msdn sites will not open up in my computer. Or by installing silver light,i can watch tutorials. Plaese give me the links to download silverlight.

sonia sardana -13 Posting Whiz
public partial class FrmOnline : System.Web.UI.Page
{
    string Query;
    SqlCommand cmd;
    SqlConnection conn;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
                     OpenSQLConnection();
           SqlCommand cmd = new SqlCommand("select * from Info1 where UID=1", conn);
           SqlDataReader dr;
           dr = cmd.ExecuteReader();
           while (dr.Read())
           {
               dr.Read();
               TextBox1.Text = dr[0].ToString();
           }
            
        }
    }


 private void OpenSQLConnection()
    {
        try
        {

            conn = new SqlConnection("Data Source=(local);Initial catalog=sonia;User ID=sonia;Password=sonia;");
            conn.Open();

        }
        catch (Exception ex)
        {
            
        }

    }

I m getting error in line TextBox1.Text = dr[0].ToString();
Invalid attempt to read when no data is present.

But the record is there in DB,of UID 1.then y the error is coming.

sonia sardana -13 Posting Whiz
if  strFile.Length <> 0
'Code
end if
sonia sardana -13 Posting Whiz

As u all know,at runtime we can move the form.
I use the foll. code,so dat form doesn't move.I want to ask dat is there any easy way to do it.
Mine code below working correctly,but lengthy-

Option Compare Text
Option Strict On
Option Explicit On

Public Class Form1
    Dim RCTransparentVerticalBar As Rectangle

    Public Sub New()
        MyBase.New()
        'This call is required by the Windows Form Designer. 
        InitializeComponent()
        'Make the fake caption rectangle 
        RCTransparentVerticalBar = New Rectangle(0, 0, Me.Width, 29)
    End Sub
    Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
        'We want to pretend that the rectangle RCTransparentVerticalBar, is the caption bar so we can drag the form by it... 
        If m.Msg = WM_NCHITTEST Then
            Call FakeCaptionForCaptionlessWindow(Me, m, RCTransparentVerticalBar)
        Else
            MyBase.WndProc(m)
        End If
    End Sub

End Class


ADD MODULE
Option Strict On
Option Explicit On
Option Compare Text

Module ModMoveForm
    Public Const WM_NCHITTEST As Long = &H84

    Public Enum HitTestResult
        HTBORDER = 18
        HTBOTTOM = 15
        HTBOTTOMLEFT = 16
        HTBOTTOMRIGHT = 17
        HTCAPTION = 2
        HTCLIENT = 1
        HTERROR = (-2)
        HTGROWBOX = 4
        HTHSCROLL = 6
        HTLEFT = 10
        HTMAXBUTTON = 9
        HTMENU = 5
        HTMINBUTTON = 8
        HTNOWHERE = 0
        HTRIGHT = 11
        HTSYSMENU = 3
        HTTOP = 12
        HTTOPLEFT = 13
        HTTOPRIGHT = 14
        HTVSCROLL = 7
        HTTRANSPARENT = (-1)
        HTOBJECT = 19
        HTCLOSE = 20
        HTHELP = 21
    End Enum

    Public Sub FakeCaptionForCaptionlessWindow(ByVal fParent As Form, ByRef m As Message, ByVal CaptionRectangle As Rectangle)

        If m.Msg = WM_NCHITTEST Then
            '\\ If the mouse is in …
sonia sardana -13 Posting Whiz
sonia sardana -13 Posting Whiz
sonia sardana -13 Posting Whiz

I was asked Suppose there is table A in DB,Suppose when we update that table,whose are two tables(Magic tables) that are updated other than table A?

sonia sardana -13 Posting Whiz

I want to change the value & its backcolor of cell.
On Button1_Click,I m adding records to the Gridview.
On Button3_Click,I want to chnage the value of cell & its backcolor.

Suppose two Rows & two columns are there in Grdiview
1 10
2 20

Suppose I want to change the value of item(Row=2,Colomn=2) to 100. I change the value but i m not ablt to change the backcolor.Can somebody tell me?

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Try

            Dim row0 As String() = {TextBox1.Text, TextBox2.Text}
            DataGridView1.Rows.Add(row0)
            row0 = Nothing

        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub


 Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Try

            DataGridView1.Item(1, 1).Value = 100
           'What to write to chnage the cell color

        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub
sonia sardana -13 Posting Whiz

I was asked Suppose there is table A in DB,Suppose when we update that table,whose are two tables(Magic tables) that are updated other than table A?

sonia sardana -13 Posting Whiz

Nobody knows the answer or nobody wants to reply?????

sonia sardana -13 Posting Whiz

SOURCE CODE

<asp:Repeater ID="Repeater1" runat="server">
                        <HeaderTemplate>
                         <table border="1" width="100%">
                        <tr bgcolor=Gray>
                        <th>ProductId</th>
                        <th>ProductName</th>
                        <th>Description</th>
                        <th>Weight</th>
                        <th>isInStock</th>
                        </tr>
                        </HeaderTemplate>

                        <ItemTemplate>
                        <tr>
                   	    <td width ="10%" height ="50%"><%# DataBinder.Eval(Container.DataItem,"ProdID") %></td>
                   	    <td width ="10%" height ="50%"><asp:HyperLink id="hlEdit" runat="server" NavigateUrl="Frmuser.aspx" Text='<%# DataBinder.Eval(Container.DataItem, "ProdName") %>'></asp:HyperLink></td>
                        <td width ="10%" height ="50%" ><%# DataBinder.Eval(Container.DataItem,"Descr") %></td>
                        <td width ="10%" height ="50%" ><%# DataBinder.Eval(Container.DataItem,"Weight") %></td>
                        <td width ="10%" height ="50%" ><%# DataBinder.Eval(Container.DataItem,"islnStock") %></td>
                        </tr>
                        </ItemTemplate>

                        <AlternatingItemTemplate>
				        <tr bgcolor="#ccccff">
				        <td width ="10%" height ="50%"><%# DataBinder.Eval(Container.DataItem,"ProdID") %></td>
                   	    <td width ="10%" height ="50%"><asp:HyperLink id="hlEdit" runat="server" NavigateUrl="Frmuser.aspx" Text='<%# DataBinder.Eval(Container.DataItem, "ProdName") %>'></asp:HyperLink></td>
                        <td width ="10%" height ="50%" ><%# DataBinder.Eval(Container.DataItem,"Descr") %></td>
                        <td width ="10%" height ="50%" ><%# DataBinder.Eval(Container.DataItem,"Weight") %></td>
                        <td width ="10%" height ="50%" ><%# DataBinder.Eval(Container.DataItem,"islnStock") %></td>
                        </tr>
				        </AlternatingItemTemplate>
				
                        <FooterTemplate>
                        </table>
                       </FooterTemplate>
                    </asp:Repeater>
public partial class FrmMain : System.Web.UI.Page
{
    SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ConnectionString);
    SqlDataAdapter da;
    DataSet ds = new DataSet();
    string query;
    SqlCommand cmd;

    protected void Page_Load(object sender, EventArgs e)
    {

        try
        {

            da = new SqlDataAdapter("SELECT * FROM Products", conn);
            da.Fill(ds, "PRODUCTS");
            Repeater1.DataSource = ds.Tables["PRODUCTS"];
            Repeater1.DataBind();  

                 }

        catch (Exception ex)
        {
           
        }


    }

Only Probs is dat i want to fix the height & width of TD.See the Description (TD) is having too much height.I wnat to fix it.See i pic.

sonia sardana -13 Posting Whiz

WEB.CONFIG FIlE

<?xml version="1.0"?>
<configuration>
    <appSettings/>
    <connectionStrings/>
    <system.web>
      <authentication mode ="Forms">
        <forms loginUrl="FrmLogin.aspx" protection="All" >
          <credentials passwordFormat="Clear">
            <user name="sonia" password="citm123"/>
            <user name="soni"  password="citm123" />
            <user name="muru" password="citm1234"/>
          </credentials>
        </forms>
      </authentication>
      <authorization>
       <allow users="sonia"/>
        <allow users ="soni"/>
        <deny users="muru"/>
         </authorization>
      <compilation debug="true"/>
         </system.web>
</configuration>

FRMLOGIN.aspx

protected void btnLogin_Click(object sender, EventArgs e)
    {
        if (FormsAuthentication .Authenticate(txtUserName .Text ,txtPassword .Text ))
        {
         FormsAuthentication.RedirectFromLoginPage(txtUserName.Text, true);

          Response.Redirect("FrmWelcome.aspx?username=" + txtUserName.Text  );
        }

    }

FRMWELCOME.aspx

protected void Page_Load(object sender, EventArgs e)
    {
       
            lblUserName.Text = Request.QueryString["username"].ToString();  

               
    }

Suppose i enter sonia in username & citm123 in password. I will be redirected to FrmWelcome. Suppose now the user copies the URL of FrmWelcome & open in other window,i want that the user is navigated to FrmLogin. How to do it.Using Cookies??? Can somebody help me out!

sonia sardana -13 Posting Whiz

Can u give me the idea which project to develop in ASP.Net & in Brief project details? I m newbie to ASP.net!

sonia sardana -13 Posting Whiz

Can somebody give me the idea of Light WIndow in ASP.Net? When i click on butoon,form appears & the current form becomes Gray.How to do dat!Can somebody tell me!

sonia sardana -13 Posting Whiz

I want to develop a project in ASP.Net. Can somebody will send me the project descriptions plz its very urgent.

sonia sardana -13 Posting Whiz

I want to after clicking on button2,after that if i click on button1 then msg is not displayed

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        MsgBox("sonia")
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        RemoveHandler Button2.Click, AddressOf MYEVENTHandler
    End Sub

    Private Sub MYEVENTHandler(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub
End Class
sonia sardana -13 Posting Whiz

I want to convert VB.Net to C# code

VB.NET-

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Try
            Dim lCount As Integer

            For lCount = 1 To 5
                ListView1.Items.Add(lCount.ToString)
            Next
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Try
            Dim lCount As Integer
            For lCount = 0 To ListView1.Items.Count
                MsgBox(ListView1.Items(lCount).Text)
            Next

        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub
End Class

C#

private void Form1_Load(object sender, EventArgs e)
        {
            int lcount;
            for (lcount = 0; lcount <= 5;lcount ++ )
            {
                listView1.Items.Add( lcount.ToString);
            }

        }

I m getting Errors
Error 1 The best overloaded method match for 'System.Windows.Forms.ListView.ListViewItemCollection.Add(string)' has some invalid arguments

Error 2 Argument '1': cannot convert from 'method group' to 'string'

sonia sardana -13 Posting Whiz

I want to develop a login page ,i want that admin username & password to be saved in asp file suppose FrmLoginDetails.asp. Username - sonia
Password - citm123
When the user logins,i want that his entered usernme & password to be compared with the that are stored in file FrmLoginDetails.asp..

Can somebody tell me how to store the details in file & retrive from that file!

sonia sardana -13 Posting Whiz

hello dnanetwork , how r u ? Have u blocked,dat nobody can send u privat message?

serkan sendur commented: bad english -2
sonia sardana -13 Posting Whiz

I have dropdown & Gridview on FrmSatelliteMain,In dropdown DataValueField uid is there,Now i want that as the user selects
the value in dropdown ,on basis of uid i will fetch the records fromm DB & bind to Gridview using AJAX.


Plz frnds dont tell me dat,dat do it using AJAX framework!!!!!

public partial class FrmSatelliteMain : System.Web.UI.Page
{
    SqlConnection conn = new SqlConnection("Data Source=(local);Initial catalog=SatelliteTVonPV;User ID=sonia;Password=sonia");
    string Query;
    SqlCommand cmd;
       SqlDataReader dr;

    protected void Page_Load(object sender, EventArgs e)
    {
      
        if (!IsPostBack)
        {
            DropDownLanguages.Attributes.Add("onChange", "javascript:return AddChannels()"); 

        }
    }


}

SOURCE CODE-
In DropDownLanguages in DataValueField,UID is there.I want to retrive all the records from DB that has UID 1 in country column.

<script type ="text/javascript" language ="javascript">
    var xmlHttp;
         
    
    function AddChannels()
    {
             
      checkXHR("Retrieve.aspx?&uid="+document.getElementById("DropDownLanguages").value);
}

     function checkXHR(url)
    {
       try
       {
         xmlHttp=new XMLHttpRequest();        
       }
       catch (e)
       {
         try
         {
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
         }
         catch (e)
         {
            try
            {
                xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");                
            }
            catch (e)
            {
                alert("Your browser does not support AJAX!");
                return false;
            }
         }
       }
      
       xmlHttp.open("GET",url,false);       
       xmlHttp.onreadystatechange=statechanged;
       xmlHttp.send(null);
    }
    
    function statechanged()
    {
       if(xmlHttp.readyState==4)
       {
         document.getElementById("hd1").value = xmlHttp.responseText;
       }
       else
       {
         document.getElementById("hd1").value="";
       }         
    }

FRMRETRIVE.aspx

public partial class Retrieve : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        SqlDataAdapter da = new SqlDataAdapter("select * from [pctv] where Country='" +
                         Request["uid"].ToUpper() + "'", conn);
        DataSet ds = new DataSet();
        da.Fill(ds);
    }
}

In FrmRetrive form load,Records are coming,But i dont know that how to bind this data with Gridview of FrmSatelliteMain!! Can somebody tell me dat???????????I want …

sonia sardana -13 Posting Whiz

Yes sir Thx........

sonia sardana -13 Posting Whiz

But i m newbie to ASP,dats y doubt is there!!

sonia sardana -13 Posting Whiz

I have made connection in web.config file,Its working ,I want to just confirmed dat Whether i m doing it in right way or not!


Web.Config File-

<configuration>
	<appSettings/>
	<connectionStrings>
		<add name="Connection" connectionString="Data Source=(local);Initial catalog=sonia;User ID=sonia;Password=sonia;" providerName="System.Data.SqlClient"/>
	</connectionStrings>

Code Behind Page

public partial class FrmPractise : System.Web.UI.Page
{
    SqlConnection conn =new SqlConnection (ConfigurationManager.ConnectionStrings["Connection"].ConnectionString ) ; 
        string query;
    SqlCommand cmd;

    
    protected void btnInsertData_Click(object sender, EventArgs e)
    {
        try
        {
         
            query = "Insert into testing values(@EmpId,@EmpName)";
            cmd=new SqlCommand (query ,conn ) ;
            cmd .Parameters .AddWithValue ("@EmpId",txtEmpId .Text ) ;
            cmd.Parameters .AddWithValue ("@EmpName",txtEmpName .Text ) ; 
            conn .Open ();
            cmd.ExecuteNonQuery ();
            conn .Close ();

        }

        catch (Exception ex)
        {
        lblError .Text =ex.Message .ToString ();
        }


    }

I have small probs more

query = "Insert into testing values('" & txtEmpId.Text & "','" & txtEmpName.Text & "')";

is there any error in the above line,I m getting Error -
Error 1 Operator '&' cannot be applied to operands of type 'string' and 'string'

sonia sardana -13 Posting Whiz

Hello sknake sir I didnt get ur code..Can u tell me is it necesarry or not to have handler.aspx ...to get the image from DB..See in mine code below-???


hello mohan sir , I m saving the multiple images & extracting the multiple images..may be this is lenthgy method,but have a look at it-

SQL
COLUMN NAME DATATYPE
id int
image1 image
img_type varchar


Drag the fileUpLoad control on the form,so dat u can choose aby file-
FrmSaveImage.aspx

public partial class _Default : System.Web.UI.Page 
{
    string query;
    SqlConnection conn = new SqlConnection("Data Source=SONIA-B408A4159\\SQLEXPRESS;Initial catalog=sonia;Integrated Security=true");
      
    protected void Button1_Click(object sender, EventArgs e)
    {

        if (FileUpload1.PostedFile.FileName == null
|| FileUpload1.PostedFile.FileName == "")
        {
            lblErrors.Text = "Please Select the file";
                  }
        else
        {
         byte[] myimage = new byte[FileUpload1.PostedFile.ContentLength]; 
HttpPostedFile Image = FileUpload1.PostedFile; 
Image.InputStream.Read(myimage, 0, (int)FileUpload1.PostedFile.ContentLength);

query = "Insert into ImageGalleyNew values(@image1,@imgtype)";
SqlCommand cmd = new SqlCommand(query, conn);
cmd.Parameters.AddWithValue("@image1", myimage);
cmd.Parameters.AddWithValue("@imgtype", FileUpload1.PostedFile.ContentType);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
        }
            }

FrmGetImage.aspx

Drag the Gridview, with one column images
CODE BEHIND PAGE

public partial class Default2 : System.Web.UI.Page
{
   
    SqlConnection conn = new SqlConnection("Data Source=SONIA-B408A4159\\SQLEXPRESS;Initial catalog=sonia;Integrated Security=true");
   
        protected void Page_Load(object sender, EventArgs e)
    {
        GridView1.DataSource = FetchAllImagesInfo();
        GridView1.DataBind();
        
         }

    public DataTable   FetchAllImagesInfo()
{
    string sql = "Select * from ImageGalleyNew";
  SqlDataAdapter da = new SqlDataAdapter(sql, conn);
  DataTable dt = new DataTable();
   da.Fill(dt);
           return dt;
}

     

    }

SOURCE TAB

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False">
            <Columns>
                <asp:TemplateField HeaderText="images">
                <itemtemplate>
                    <asp:Image ID="Image1"  Width="50" Height="50"  runat="server" ImageAlign ="Middle" ImageUrl='<%#"GetDBImage.ashx?id=" …
sonia sardana -13 Posting Whiz

Below code is opening Folder Browser dialog on button click, I want that if mine PC is in network..In Folder Browser Dialog even the network drives are coming,I want that Network Places do not come in treeview.Is it possible??

Option Strict On
Option Explicit On
Option Compare Text

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Try
            Dim obj As New FolderBrowserDialog
            If obj.ShowDialog = Windows.Forms.DialogResult.OK Then
                MsgBox(obj.SelectedPath)
            End If

        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub
End Class
sonia sardana -13 Posting Whiz

I have earlier SQL 2005 Express Edition install..I remove it from control panel.But its not completely remove,can somebody tell me how to completely remove it. Cz now I m using SQL Server 2000 ,even if i craete the user & connect to DB using SQL server authentication,I m still getting the same error..My frnd told me to completely uinstall SQL 2005 might solve this errror!!!!!

Can somebody tell y i m getting the same error even if I connect using SQL authentication???? Is the reason same told by mine frnd!!!

Tell me one thing more ,Suppose while creating a user , Suppose i give username A & default databse is sonia..& there is also other user named B whose default DB is sardana.

SO can i use the username A to connect to DB sardana or only username A can be used to connect to DB sardana .

Mine update Code,Still getting the same Error

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 FrmRegistration : System.Web.UI.Page
{

    SqlConnection conn = new SqlConnection("Data Source=(local);Initial catalog=sonia;User ID=sonia;Password=sonia;Integrated Security=true");
    string query;
    SqlCommand cmd;

    //http://www.daniweb.com/forums/thread213382.html
    protected void Page_Load(object sender, EventArgs e)
    {
        btnSubmit.Attributes.Add("onclick", "Javascript: return Validations() ");
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        query = "Insert into UserInfo values(@name,@email)";
        cmd = new SqlCommand(query, conn);
        conn.Open();
        cmd.Parameters.AddWithValue("@name", txtName.Text);
        cmd.Parameters.AddWithValue("@email", txtEmail.Text);
        cmd.ExecuteNonQuery();
        conn.Close();
        Session["Name"] = txtName.Text;
        Session ["Email"]=txtEmail .Text ; 
        Response.Redirect("FrmUserDetails.aspx"); …
sonia sardana -13 Posting Whiz

I have earlier SQL 2005 Express Edition install..I remove it from control panel.But its not completely remove,can somebody tell me how to completely remove it. Cz now I m using SQL Server 2000 ,even if i craete the user & connect to DB using SQL server authentication,I m still getting the same error..My frnd told me to completely uinstall SQL 2005 might solve this errror!!!!!

Can somebody tell y i m getting the same error even if I connect using SQL authentication???? Is the reason same told by mine frnd!!!

sonia sardana -13 Posting Whiz

have u any textboxes of such names in ur design view or not???????

sonia sardana -13 Posting Whiz

just remove the txtName.Text & type it again..Dont cut & paste it again...

sonia sardana -13 Posting Whiz

ks so simple it is..I m showing u the code dat add data to SQL database but from textbox,U just change dropdown here..

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 FrmRegistration : System.Web.UI.Page
{
   
    SqlConnection conn = new SqlConnection("Data Source=SONIA-B408A4159\\SQLEXPRESS;Initial catalog=sonia;Integrated Security=true");
    string query;
    SqlCommand cmd;
 
 
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        query = "Insert into UserInfo values(@name,@email)";
        cmd = new SqlCommand(query, conn);
        conn.Open();
        cmd.Parameters.AddWithValue("@name", txtName.Text);
        cmd.Parameters.AddWithValue("@email", txtEmail.Text);
        cmd.ExecuteNonQuery();
        conn.Close();
      
      
    }
}
create table UserInfo(Name varchar(100),EMail varchar(100))
select * from UserInfo
delete from UserInfo
sonia sardana -13 Posting Whiz

Just copy & run the code..But its in VB.net..U want this??

Option Strict On
Option Explicit On
Option Compare Text

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Try
            Dim lCount As Integer
            Dim tvw As TreeNode

            For lCount = 1 To 5
                tvw = TreeView1.Nodes.Add(lCount.ToString)
                tvw.Name = lCount.ToString
                Application.DoEvents()
            Next
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Try
            Dim findnode As TreeNode

            findnode = TreeView1.Nodes.Item("1")
            findnode.Nodes.Add("First")

        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Try

            Dim findnode As TreeNode

            findnode = TreeView1.Nodes.Item("2")
            findnode.Nodes.Add("Second")

        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub
End Class
sonia sardana -13 Posting Whiz

hi frnd , can u plz explain ur question more clearly...or send me ur question on mine id <EMAIL SNIPPED>

sknake commented: keep it on the forum! -2
sonia sardana -13 Posting Whiz

I have currently two forms in mine website..I m also posting their codes--

FrmRegistration.aspx

public partial class FrmRegistration : System.Web.UI.Page
{
   
    SqlConnection conn = new SqlConnection("Data Source=SONIA-B408A4159\\SQLEXPRESS;Initial catalog=sonia;Integrated Security=true");
    string query;
    SqlCommand cmd;
    
    protected void Page_Load(object sender, EventArgs e)
    {
        btnSubmit.Attributes.Add("onclick", "Javascript: return Validations() ");
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        query = "Insert into UserInfo values(@name,@email)";
        cmd = new SqlCommand(query, conn);
        conn.Open();
        cmd.Parameters.AddWithValue("@name", txtName.Text);
        cmd.Parameters.AddWithValue("@email", txtEmail.Text);
        cmd.ExecuteNonQuery();
        conn.Close();
        Session["Name"] = txtName.Text; 
        Response.Redirect("FrmUserDetails.aspx");
      
    }
}

FRMUSERDERATILS-

public partial class FrmUserDetails : System.Web.UI.Page
{
    
    protected void Page_Load(object sender, EventArgs e)
    {
        lblUserName.Text = "SONIA";
        //lblUserName.Text = Session["Name"].ToString ();
                
    }
}

I publish the website using the foll. steps -

1. go to your root directory (in which your IIS is installed....assuming that you are using winxp sp2 and if you installed ur OS in "C" drive then usually your IIS's root folder does exist in -->"C:\Inetpub\WWWRoot")
2. Create a new folder there with any name you wish...e.g. TESTSITE for an example
3. Come back to VS2005 IDE....open your website
4. Goto "Build" menu and select "Publish Website" option.
5. Now click on ellipse(...) button and click to select "Local IIS" from the left panel of the dialog box that appears
6. Expand the "Default Web Site" node...there you can see the folder("TESTSITE") that you just created...Select the folder and click Open (if you see any message click on YES to proceed)
7. Make sure that the option "Allow this precompiled site to be updateable" is checked
8. Now …
sonia sardana -13 Posting Whiz

I used the GridView1_RowDeleting Event to delete from the gridview .

use sonia
select * from Info1
drop table Info1
create table Info1(UID integer,FirstName Varchar(100),LastName varchar(100),EMail varchar(100),Address varchar(100),PhoneNo varchar(100))

Insert into Info1 values(1,'Sonia','Sardana','a@yahoo.com','FBD','2222')

Insert into Info1 values(2,'Shouvik','Choudhary','b@yahoo.com','KolKatta','9848484474743')

Insert into Info1 values(3,'A','Ad','ds@yahoo.com','qqwD','9444212270')

Suppose I delete record that has UID 2,Now I want that mine records to be in database are

1 Sonia Sardana a@yahoo.com FBD 2222
2 A Ad ds@yahoo.com KolKatta 9444212270

Which Query to be Used that update all the records in database!!

sonia sardana -13 Posting Whiz

I bound the Gridview to the database,Now I want that in each row edit link is there,When i click on dat,then the data of data row comes to edit mode...


SOURCE TAB

<asp:GridView ID="GridView1" runat="server"  onrowediting="GridView1_RowEditing"  AutoGenerateColumns="False">
                        <Columns>
                            <asp:BoundField HeaderText="SNo" DataField ="UID" />
                            <asp:BoundField HeaderText="First Name" DataField ="FirstName" />
                            <asp:BoundField HeaderText="Last Name"  DataField ="LastName" />
                            <asp:BoundField HeaderText="EMail"  DataField ="EMail" />
                            <asp:BoundField HeaderText="Address" DataField ="Address" />
                            <asp:BoundField HeaderText="Phone No"  DataField ="PhoneNo" />
                            <asp:TemplateField > 
                             <ItemTemplate> 
                    <asp:LinkButton ID="lnkEdit" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit" ></asp:LinkButton> 
                </ItemTemplate>
                </asp:TemplateField>
                        </Columns>
                    </asp:GridView>

CODE BEHIND

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 FrmShowData1 : System.Web.UI.Page
{
    string Query;
    SqlCommand cmd;
    SqlConnection conn;
   
   

    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                OpenSQLConnection();
                Query = "SELECT * FROM Info1";
                cmd = new SqlCommand(Query, conn);
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                DataSet ds = new DataSet();
                da.Fill (ds);
                GridView1.DataSource = ds;
                GridView1.DataBind();
            }
        }

        catch (Exception ex)
        {
            Label1.Text = ex.Message.ToString();
        }

    }

    private void OpenSQLConnection()
    {
        try
        {
            conn = new SqlConnection("Data Source=SONIA-B408A4159\\SQLEXPRESS;Initial catalog=Sonia;Integrated Security=true;");
            conn.Open();
        }
        catch (Exception ex)
        {
            Label1 .Text = ex.Message.ToString();
        }

    }
   
    protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
    {
        GridView1.EditIndex = e.NewEditIndex;
    }
    
   
}

When i click on the edit link,then firstly page is postbacked,& when i click again,then in current row textboxes come,but i also want the data to come in textboxes of the current cell....Can someebody tell …

sonia sardana -13 Posting Whiz

hi sknake,below is the C# code

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Text;


namespace From_C_Sharp
{
	/// <summary>
	/// Summary description for Form1.
	/// </summary>
	/// 
	public class Form1 : System.Windows.Forms.Form
	{
#if _DEBUG
const string WmCpyDta = "WmCpyDta_d.dll";
#else
const string WmCpyDta = "WmCpyDta.dll";
#endif

		[DllImport("user32.dll",EntryPoint="FindWindow")]
		private static extern int FindWindow(string _ClassName, string _WindowName);


		[DllImport(WmCpyDta,EntryPoint="WmCpyDta_SetMessageId")]
		private static extern int WmCpyDta_SetMessageId(int iMsgId);

		[DllImport(WmCpyDta,EntryPoint="WmCpyDta_GetMessageId")]
		private static extern int WmCpyDta_GetMessageId();

		[DllImport(WmCpyDta,EntryPoint="WmCpyDta_SendMessage_sTagData")]
		private static extern int WmCpyDta_SendMessage_sTagData(int hReceiver , int hSender, string _strTag, string _strData);

		[DllImport(WmCpyDta,EntryPoint="WmCpyDta_SetEncrypt")]
		private static extern void WmCpyDta_SetEncrypt(char c);

		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.Button button2;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public Form1()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.button1 = new System.Windows.Forms.Button();
			this.button2 = new System.Windows.Forms.Button();
			this.SuspendLayout();
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(8, 16);
			this.button1.Name = "button1";
			this.button1.Size = new System.Drawing.Size(264, 40);
			this.button1.TabIndex = 0;
			this.button1.Text = "Ping -  send a message …
sonia sardana -13 Posting Whiz

Suppose I have two exes WindowsApplication1.exe WindowsApplication2.exe..On the form load of WindowsApplication2.exe,I m calling WindowsApplication1.exe & sending the command line arguements..I copy the WindowsApplication1.exe into the debug folder of WindowsApplication2.exe.

WindowsApplication2.exe

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Process.Start(Application.StartupPath & "\" & "WindowsApplication1.exe", "one" & "two")
    End Sub

WindowsApplication1.exe

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        MsgBox(Command)
    End Sub

On form load of WindowsApplication2.exe,WindowsApplication1.exe is started & arguments are sent.
Now I want to check on form load of WindowsApplication2.exe,I do not want to start WindowsApplication1.exe, i just want to send the arguments to the WindowsApplication1.exe. Is is possible? To send the command line arguments to the ruunning exe.

sonia sardana -13 Posting Whiz

THX BOTH OF U
Working Code

protected void Page_Load(object sender, EventArgs e)
    {
           try
           {
             if (!IsPostBack)
             {
           txtCompanyName.Attributes.Add("onblur", "javascript :  ConvertToUpperCase()");

 }
           }
           catch (Exception  ex)
           {
               lblStatus .Text =ex.Message .ToString ();
           }
    }


 function ConvertToUpperCase()
            {
            var numaric = document.getElementById ("txtCompanyName").value;
            numaric =numaric.charAt(0).toUpperCase() + numaric.substring(1);
            var pos = numaric.indexOf(" ");
            while(pos > -1)
                {
                  numaric =numaric.substring(0,pos+1) +  numaric.charAt(pos+1).toUpperCase() + numaric.substring(pos+2);
                  pos = numaric.indexOf(" ", pos+1);
                }
            document.getElementById ("txtCompanyName").value=numaric;
           }

Suppose i type miss sonia sardana in textbox when the control loss focus or when we press tab.output is Miss Sonia Sardana..Although its long process,because there is no way to replace character at a particular position in string...any better ideas are welcome?

sonia sardana -13 Posting Whiz
function ConvertToUpperCase()
            {
            var result;
            var numaric = "sonia";
            var Character = numaric.charAt(0);
            result=Character.toUpperCase(); 
              //In Result char is coming in UpperCase
              /[B]/I want how to replace the charater at postion 0 in numaric with result[/B]
            }
sonia sardana -13 Posting Whiz

Suppose I have webbrowser in mine form..Is it possoble to capture only the cookies create by mine webbrower..suppose before starting the project,in mine cookies folder there are cookies names cookie1 & cookie2....Suppose after the project run.cookies created by mine project are named cookie3 & cookie4...I want to delete cookie3 & cookie4 only..Is there any way to do it???? Ur reply is hightly appreciated.

sonia sardana -13 Posting Whiz

hi frnd tell me one thing,there is no update panel in the toolbox..R u using AJAX toolkit.....?I dont want to use AJAX framework,...In PHP we have div tag,thru which we can refresh only the part of the image,We just change the src attribute of it?..Can somebody tell me how to use div tag & load page using div tag..

sonia sardana -13 Posting Whiz

hi frnd tell me one thing,there is no update panel in the toolbox..R u using AJAX toolkit.....?I dont want to use AJAX framework,...In PHP we have div tag,thru which we can refresh only the part of the image,We just change the src attribute of it?...is there any div tag in ASP.Net??