amitshrivas 0 Light Poster

Hello All
i have a query on (Union all) clause
i want to create a table through union clause.
the code i am trying to execute is:

select * into table1 from (select * from partmst union all select * from importexcel) as mytemp

but it shows error

Server: Msg 451, Level 16, State 1, Line 1
Cannot resolve collation conflict for column 3 in SELECT INTO statement.

what should i do :( please help me i want to create it ASAP..

amitshrivas 0 Light Poster

Let me show your code.

amitshrivas 0 Light Poster

Hello to all..plz help me in this plzzzzzzzzzzzzz
i want to view/download a files from production server and after downloading i want to delete the same file from 2 places i.e from (database and one Uploaded folder in server).
i have 2 quries:

1: View Only ?
i have this code to view a file but it won't work for .xls files

Response.Clear();
   Response.AppendHeader("content-disposition", "inline;   
   filename=" + filename);
   Response.ContentType = conttype;
   Response.TransmitFile(Server.MapPath("~") + @"\Schedule\" + 
   filename);
   Response.End();
   Response.Flush();

this code works perfectly for .txt and .doc file but wont work for .xls means This will show open/Save Filedialog box which i dont want to see if i click on View Link

2: i want to download a fle from production server.
and the code i have written is

Response.Clear();
     Response.AppendHeader("content-disposition", "attachment; filename="+ filename);
        Response.ContentType = cont;
        string filepath = Server.MapPath("~") + @"\Schedule\" + filename;
        Response.WriteFile(filepath);
       
//        DeletRecordFromDatabase();
//        File.Delete(filepath);
//        LoadSchedule();
        Response.End();
        
        Response.Flush();

please read the code carefully..
specially in between this

Response.WriteFile(filepath);
       
//        DeletRecordFromDatabase();
//        File.Delete(filepath);
//        LoadSchedule();
        Response.End();
Response.Flush();

the commented part are the functions through which i will delete the file form Database,from Folder and Reload all the fresh data from database..to gridview
but when i click on Download link then it will not show the Open/Save Dialog box rather it will delete the file form database and from folder too.
and when i write the code something like this

Response.WriteFile(filepath);
        Response.End();
//        DeletRecordFromDatabase();
//        File.Delete(filepath);
//        LoadSchedule(); …
amitshrivas 0 Light Poster

I need some help here.
I have a page which I am using the ToolkitScriptManager for the use of some AJAX Calendar Control Extenders, and that works fine.
Where I am running into a problem is using the UpdatePanel. I am not getting a partial or any postback on a listbox control.

I have tried adding the regular ScriptManager and I get errors and when I have both of them loaded, ToolkitScriptManager and ScriptManager, I get an error saying that you can only have one Scriptmanager on the page.

Please help.

Thanks in advance

Use One ..
and Refere this link
http://blog.turlov.com/2008/05/scriptmanager-vs-toolkitscriptmanager.html

amitshrivas 0 Light Poster

Hi to all..
i have some doubts in my mind that what should i remember when i uploaded a asp.net website to live server and also if i use database then what precautions should i take so that my website will not hamper with these issuess..

amitshrivas 0 Light Poster

@amitshrivas : ur answer solves the positioning of other controls except "Label" which is fixed in its Left Top position.

Actually you have already taken the Label control before all these settings to made may be that's the reason just drag it that control and it will automatically adjust to left top of window then after you can adjust that Label Control accordingly

amitshrivas 0 Light Poster

ya,its worked.........i m so happy....
I take two days to rectify the error.
Thanks for ur reply

Your Welcome and i am also happy that your problem is solved and its pleasure to help u and in future you will help me :D

amitshrivas 0 Light Poster

Hi,
I had a problem when display the total amt from sql to textbox
------------------------------
create table get(Currentdate varchar(200),Expenses varchar(200),Amount decimal(38,2))-this a table
------------------------------
asp.net codings
--------------------------
mycomm.CommandText = "SELECT sum(Amount) from get"

dr = mycomm.ExecuteReader
While dr.Read()
TextBox6.Text = dr.GetDecimal(2)

End While
dr.Close()

--------------------------------------------------------------
Error:
Index was outside the bounds of the array.
how i rectify the error
Thanks in advance

TextBox6.Text = dr.GetDecimal(0)

because -- sum(Amount) is in 0 index..

amitshrivas 0 Light Poster

i am completly new to this programming language,but i know the features of the .net that wht is c#,asp.net and sql server.and presently working with s/w company where i need to work on ajax plzzzzzzzzzzzzzz suggets me how will i do

if u r working in VS tool then u need to have ajax toolkit to use the functionality of ajax..
to run any ajax control in aspx page u need to have Script Manager. with u.
refer this link..
http://www.asp.net/%28S%28fu2l2uzphr2u3u45q2dnez55%29%29/ajax/AjaxControlToolkit/Samples/

it will help u..

amitshrivas 0 Light Poster

I am looking to DYNAMICALLY use the Edit button under the SqlDatasource to update a GridView. The reason for this is that the data that will be upddated to dynamic table names and tables that are different sizes dependent on what month it is (since different months have different days in the month) I have been trying to get this to work with AutoGenerateEditButton and have been less than sucessful... Any ideas wwould be greatly appreciated

Can u show the code which u have created so it helps more to understand the problem..
thanks

amitshrivas 0 Light Poster

hi friends.. i am doing asp.net project.. in that project in login page if any one enter wrongly more than 4 times username or password means i want to show dummy page that time i need to save that person IP Address and his details...my Question is how can i count the wrong attempt and how can i get IP address.. plz help me for me.. thanks in advance..send to my mail..


by SP

..................
To get the IP Address

Response.Write(Request.UserHostAddress.ToString());
        Response.Write(Request.UserHostName.ToString());
        Response.Write(Request.ServerVariables["REMOTE_HOST"]);
        Response.Write(Request.ServerVariables["REMOTE_ADDR"]);

They all give same output

and try to use static variable for counting number of logins..

amitshrivas 0 Light Poster

Hi to all, I have installed VS2008 pro in Xp sp2 pro. I have a problem with positioning of the controls while in the Design mode during a webpage development. Whenever I Add a "BUTTON" or any control in the form and want to drag it anywhere within the form means I need to "Select the Control " then Goto "Format->Position->Absolute". After this I can place the control anywere in the form. Is there any way to overcome it ?

................
Go on Tools->options->HtmlDesigners->CSS Positioning and select the top most check box and select Absolute Postioning. and OK

amitshrivas 0 Light Poster

I have a piece of code which is used by several aspx.cs pages and I want to put that code in a separate page so that all these pages access that separate page.

I dont think i can use classes for this....

Its good idea to use Classes which is comman and shareable to all..
put ur class in App_Code folder, and classes which is created inside it will be sharable to whole applictaion.

amitshrivas 0 Light Poster

i have created some tables in XML which perform all DML operations perfectly. now my question is how can i give security to these tables as we get in databases(sqlserver,oracle)..

Please help me out in this..and try to give anwser in simple way

amitshrivas 0 Light Poster

hello, I 'm still a noob at programming in vb.net
I have a little problem. I 'm trying to get my selected rows to another page. I already can select my rows with checkboxes but I don't know how I can pass them through a session to another page.
hopefully someone can help me.

greetz

Are u using GridView control and get connected by database...
is that so..
then
u must be knowing Global.asax
inside session_start
declare a session variable..

Session["name"]=null;

On GridView_Selected change

int index = GridView1.SelectedIndex;
        for (int i = 1; i < GridView1.Rows[index].Cells.Count; i++)
        {
            Response.Write(GridView1.Rows[index].Cells[i].Text);
            Session["name"] += GridView1.Rows[index].Cells[i].Text+".";
        }

and how to retrive the value from session..

string[] splitData;
        if (Session["name"] == null)
        {
        }
        else
        {
            string valuefromsession = Session["name"].ToString();
            splitData = valuefromsession.Split('.');
            for (int i = 0; i < splitData.Length-1; i++)
            {
                Response.Write("Name :" + splitData[i].ToString() + "<br/>");
            }
        }

i hope this will help u

amitshrivas 0 Light Poster

Hi, I got one masterpage and one content / child page having gridview control

I want to do client side validations using javascript, can anyone suggest me where i have to do this.
i.e.., either in masterpage or in content page
(I know that only at the <head> tags we can include javascript file, but in content pages there are no html tags, please suggest),

i don't want to use server side validation controls , and i want to validate the server side controls in gridview

...........................
This code will help u as i also suffer this problem and found the solution..

In ur MasterPage.aspx.cs/vb write This Code.

protected void Page_Init(object sender, EventArgs e)
    {
        this.ID = "MyMasterPage"; // or whatever name you prefer
    }

then after
inside your contentplaceholder use javascript as u need..

and how to access the values of controlss..

document.getElementById('MyMasterPage_ContentPlaceHolder1_urcontrolid/name').value;

i hope this will help u surely..

amitshrivas 0 Light Poster

Hello There..
i created this code...plz refer it..
i hope this is will work for u..

string[] splitData;
        if (Session["name"] == null)
        {
        }
        else
        {
            string valuefromsession = Session["name"].ToString();
            splitData = valuefromsession.Split('.');
            for (int i = 0; i < splitData.Length-1; i++)
            {
                Response.Write("Name :" + splitData[i].ToString() + "<br/>");
            }
        }
amitshrivas 0 Light Poster

I’ve been trying to wrap my brain around this now for days,
and I’m getting nowhere, so please bear with me…

To Remove file on click of linkbutton I have below code:

aspx page:

<asp:LinkButton ID="RemovefileId" runat="server" CommandName="RemoveFile"  OnCommand="RemoveFilefunction" CommandArgument=<%#Eval("filepath")%>>LinkButton</asp:LinkButton>

aspx.cs page

protected void RemoveFilefunction(object sender, CommandEventArgs e)
 {
            string x = e.CommandArgument.ToString();//why Here x is empty string 
  //If U have any idea to delete file then help me..
  }

plz tell me any wrong in aspx file.

............
i think in aspx page u made a mistake..
i have tried this code and i m getting the CommandArguement value..
Modification...u need to do..

CommandArgument='<%#Eval("filepath")%>'

i hope this modification will solve the problem

amitshrivas 0 Light Poster

Hi friends,
i have made an website and running it through iis after publishing. But is showing an error:

Server Error in '/' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load the assembly 'App_Web_bddfy6qh'. Make sure that it is compiled before accessing the page.
...

Line 1: <%@ page language="VB" autoeventwireup="false" inherits="Login, App_Web_bddfy6qh" title="Domain Management Login " %>
Line 2:
Line 3: <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>


Source File: /Domainmanagementmain/login.aspx Line: 1

Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3082


Plz help me solving i have put all the files in one single folder.

..
are u uploading it on Local server r Live server

amitshrivas 0 Light Poster

I am using VB.NET on VS2008 and currently building a web application for budgeting

so here's the problem, I have created a gridview to show a database on a table. Let's say I have a buttonlink in the gridview to change the content on a column ( for example I have an APPROVAL column to show the status of the approval with the default 0 and when I click the APPROVE button, the APPROVAL change into 1, and change to 2 when I click REJECT)

how to do that? please explain to me with a sample code... thanks :)

..
Please show the Code..for reference..

amitshrivas 0 Light Poster

Hello There..try this..
this code is not so sofasticated but u will get help..

Label1.Text = "";
        string[] listofNews ={ "News", "News", "News", 
                               "News", "News", "News", 
                               "News", "News", "News",
                               "News","News","News" };
        Label1.Text = "<br/>";
        for (int i = 0; i < listofNews.Length; i++)
        {
            Label1.Text += "<b><a href='#'>&nbsp;&nbsp;" + listofNews[i].ToString() + "&nbsp;&nbsp;</a></b>";
            if (i == 2)
            {
                Label1.Text += "<br/>";
            }
            else if (i == 5)
            {
                Label1.Text += "<br/>";
            }
            else if (i == 8)
            {
                Label1.Text += "<br/>";
            }
            
        }

Try it out..by your own for inside loop okk

amitshrivas 0 Light Poster

Thanks Sir for Your Rply.

amitshrivas 0 Light Poster

Hi to all..
How we can delete a record from a database after downloading through
Response.AppendHeader....

Questions Regarding Open/Save File Dialog box
1: if i only wants to view the file without saving it what should i use there.
2:if i want to download a file and then that downloaded file will be deleted from database..

How can i do these..
Plz help me in this Issue..
Thanks & Regards
Amit

amitshrivas 0 Light Poster

>i m new to Dani web IT Community. so can u tell me the rules of what to right and what not in easy way..


Please read before posting - http://www.daniweb.com/forums/thread78223.html and http://www.daniweb.com/forums/faq.php?faq=daniweb_policies

------------------
Hi..again
i uploaded a aspx page succusfully and its running now..
but my next problem is related with database..
i created database in Live server and after that i run it .
its running but it will take me to custompage.html again..
may be my configuration to web.config file is wrong..
what would be the standard configfuration ..

amitshrivas 0 Light Poster

I copy the code of xml and save it by .xml and run it in IE .it runs ok,showing no error what would be the problem sir. and
i m new to Dani web IT Community. so can u tell me the rules of what to right and what not in easy way..
plzz coz i got warning from Dani WEb community.. :(

amitshrivas 0 Light Poster

Or u can write the following code..
u have 4 feilds in database
Id,FirstName,LastName and title

First Set the primary Key as Autogenrated in Database creation or alter it..
then in C#.. use..

sqlconnection conn=new SqlConnection(connectionString);
string StrCmd="insert into TableName(FirstName,LastName,Title) values('"+TextBox.Text.Trim()+"','"+TextBox2.Text.Trim()+"','"+TextBox3.Text.Trim()+"')";
Sqlcommand cmd=new Sqlcommand(StrCmd,conn);
int CheckRecord=0;
conn.open();
CheckRecord=cmd.ExecuteNonQuery();
if(CheckRecord>0)
{
   //confirmation Message..
}
cmd,dispose();
cmd=null;
conn.close();

i hope this will work for u.. thanks

amitshrivas 0 Light Poster

I don't need to change anything? I need to add a new row in the root DB and i am asking how i can make it work. So i ask you.. Is it possible to do with dataset? or is it just temporary like all the other stuff i have tried? =s

///////////////////////////////////
This is your code..right
////////////////////////

System.Data.SqlClient.SqlCommandBuilder cb;
      cb = new System.Data.SqlClient.SqlCommandBuilder(da);
      DataRow dRow = ds1.Tables["Users"].NewRow();
      dRow[1] = textBox1.Text;
      dRow[2] = textBox2.Text;
      dRow[3] = textBox3.Text;
       
      ds1.Tables["Users"].Rows.Add(dRow);
      MaxRows = MaxRows + 1;
      da.Update(ds1, "Users");

You suppose to write this code too
ds1.AcceptChanges();
so that The new record will updated in database..

amitshrivas 0 Light Poster

Did you try this and did not work?
"<customErrors> tag should then have its "mode" attribute set to "Off".""
<customErrors mode="Off" />

if i set CustomError mode="off" then it will give me Parser Exception
and if i set CustomError mode="remoteOnly"|"On" then it will redirect me to MyCustomError.htm page
dont show the aspx page

amitshrivas 0 Light Poster

Hi..
There have u set the Identity for Primary key in database means is it auto generated r not..if it is autogenerated no need to give..
and if u using Dataset for inserting record..
use this for changes.. hope it wil work..
da.Update(ds1, "Users");
ds1.AcceptChanges();

amitshrivas 0 Light Poster

Use SqlCommand and SqlDataReader for this..
like
SqlCommand cmd=new SqlCommand(queryNoHP,urconnobject);
urconnobject.open();
SqlDataReader rd=cmd.ExecuteReader();
if(rd.read())
{
no_hp =rd.GetString(0);
}
-------------------------
i hope this willw work for u..
try it

amitshrivas 0 Light Poster

Hi.to all
This is Amit..
i have one website in which i m using (html,aspx) pages.
i uploaded also to my domain.
HTML pages works properly but when i request for ASPX page it shows :::::::::::::::::::
------------------------------------------------------------------------------------
"Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off"."
-----------------------------------------------------------------------------------
after this i changed my web config file and set the custom error mode="remoteonly" and defaultUrl="MyCustomerror.html" then i build it and Publish it once again and upload it again to server.
when i again equest for aspx page it will redirect me to MyCustomerror.html..
so how can i request for aspx page..and this is just a normal wellcome page of aspx No database, No server side coding i used in this page..if this problem solved then i can think about database creation..into my domain..
please help me in this topic..
eagarly waiting for anybudy's reply..

Thanks..
Amit