|
if the item is already existing then check whether whether u are calling these lines
ddlist.SelectedValue=session("name")\\it gives null
ddlist.SelectedItem.Text=session("name")\\\it gives object reference not set to instance of object error.
before the dropdownlist is populated or after!!!
if you are running it before the population then it cannot find the dropdownlist and it will give a null reference exception!!!
I was born dumb!!
Programming made me laugh !!!
--sid--
|
|
|
|
|
What is wrong with this....I don't know this morning what is happening with me..Is it because of 07/07/07....
My dtrCat (data reader) is getting -1 record affected.........Conenction is fine.............Pl help me from 07/07/07 devil.....
---------------------
SqlConnection conDotNet;
SqlCommand cmd;
SqlDataReader dtrCat;
conDotNet=new SqlConnection();
conDotNet.ConnectionString="Server=SBServer;User=sa;Password=;database=SB;";
cmd=new SqlCommand();
cmd.CommandText="Select * from dbo.TB_QueryMaster";
cmd.CommandType=CommandType.Text;
cmd.Connection=conDotNet;
cmd.Connection.Open();
dtrCat=cmd.ExecuteReader(CommandBehavior.CloseConnection);
catlist.DataSource = dtrCat;
catlist.DataBind();
cmd.Dispose();
conDotNet.Dispose();
Amit
|
|
|
|
|
Amit Kumar G wrote: Is it because of 07/07/07
LOL.
Please ask it in the Correct Forum.
Regards,
Satips.
Don't walk in front of me, I may not follow;
Don't walk behind me, I may not lead;
Walk beside me, and just be my friend. - Albert Camus
|
|
|
|
|
This is ASP.Net forum and my query is related to the same.....
Regards
Amit
|
|
|
|
|
What problem you are having ?
it is getting one record affected means?
Regards,
Satips.
Don't walk in front of me, I may not follow;
Don't walk behind me, I may not lead;
Walk beside me, and just be my friend. - Albert Camus
|
|
|
|
|
My query only returns -1 which means no record affected.....I checked the database table and data is there, connection is fine ..........
Satips...Please help me, i have seen lot of replies from your side....
Thanks!!
Amit
|
|
|
|
|
Amit Kumar G wrote: My query only returns -1 which means no record affected
True.
Amit Kumar G wrote: I checked the database table and data is there, connection is fine
Ok.
Then what problem?
Regards,
Satips.
Don't walk in front of me, I may not follow;
Don't walk behind me, I may not lead;
Walk beside me, and just be my friend. - Albert Camus
|
|
|
|
|
Satips wrote: Ok.
Then what problem?
I believe that is what his original question was
Thanks for your valuable contribution in asking him the same question he has asked you.
only two letters away from being an asset
|
|
|
|
|
Amit Kumar G wrote: My dtrCat (data reader) is getting -1 record affected
Yes, of course. A select query does not change any data.
From MSDN library:
"SqlDataReader.RecordsAffected Property
Gets the number of rows changed, inserted, or deleted by execution of the Transact-SQL statement."
---
single minded; short sighted; long gone;
|
|
|
|
|
I always thought it should return 0 rather than -1.
|
|
|
|
|
It's all in the documentation, plain to read:
"Property Value
The number of rows changed, inserted, or deleted; 0 if no rows were affected or the statement failed; and -1 for SELECT statements."
---
single minded; short sighted; long gone;
|
|
|
|
|
Well I know that is what it does, but logically it seems 0 would be more appropriate. I'm questioning someones design decision not you answer
|
|
|
|
|
Well, a zero would mean that there were zero records uppdated. As there shouldn't be any updated records, there shouldn't be any count of them either, so I can see how a value representing a non-count would be more appropriate than a count of zero.
---
single minded; short sighted; long gone;
|
|
|
|
|
That makes sense I suppose.
|
|
|
|
|
What is wrong in this ....In IE i can not see repeater control...
<%@ Page Language="C#" MasterPageFile="~/WebForms/MasterPage.master" AutoEventWireup="true" CodeFile="Query.aspx.cs" Inherits="WebForms_Login_Query" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="server">
<asp:Repeater ID="catlist" runat="server">
<HeaderTemplate>
<tr>
<td>
Amit Header
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
Amit Item
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
<tr>
<td>
Amit Footer
</td>
</tr>
</FooterTemplate>
</asp:Repeater>
</asp:Content>
Amit
|
|
|
|
|
Are you actually binding data to it?
only two letters away from being an asset
|
|
|
|
|
|
If you are not binding anything to it then what's the point in using it?? Just create a HTML table.
only two letters away from being an asset
|
|
|
|
|
I have make code for file upload on webserver with resume upload, working on local server correctly but not on webserver
try to use codes like this , use 2 text boxes and one button, in first text box write c:\1.dat , in other textbox 2.dat, i.e file from your local harddisk c named 1.dat will copy on the servers folder uploads with name 2.dat, it works well on local server but error occurs on web server
the error is
"Could not find file 'c:\1.dat'. "
you can check this error by using different extension and size files.
By this code, file will not use web servers memory, file will transfers in chunks ( parts ) and append on the server, this is a very usefull thing if somebody want to upload large files in GB.
Please note before answering the problem that lots of FTP softwares available in the market that supports resume upload but on FTP server, not on normal http server as a normal user.
My code are working just like yahoo mail attachment with additional advantage of resume support.
codes are
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
using System;
using System.Data;
using System.Configuration;
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.IO;
public partial class _Default : System.Web.UI.Page
{
int bufferSize = 100;
int bytesRead = 0;
string ImagesFolder = "uploads";
string savePath;
string saveFile;
long sentBytes = 0;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
FileStream fs = new FileStream(TextBox1.Text, FileMode.Open, FileAccess.Read);
savePath = Path.Combine(Request.PhysicalApplicationPath, ImagesFolder);
saveFile = Path.Combine(savePath, TextBox2.Text);
fs.Seek(this.sentBytes, 0);
byte[] buffer = new byte[bufferSize];
bytesRead = fs.Read(buffer, 0, bufferSize);
while (bytesRead > 0)
{
AppendChunk(buffer, sentBytes, bytesRead);
this.sentBytes += bytesRead;
bytesRead = fs.Read(buffer, 0, bufferSize);
}
fs.Close();
}
public void AppendChunk(byte[] buffer, long offset, int bufferSize)
{
FileStream FSs = new FileStream(saveFile, FileMode.Append);
FSs.Write(buffer, 0, bufferSize);
FSs.Close();
}
}
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
But the codes are not working on real web server.
Thanks
Shailendra
|
|
|
|
|
Hi.How to show the Text in Hindi at browser without installing the hindi font at the client machine.
|
|
|
|
|
http://quillpad.in/new/quill.html
Type words in English and they will be produced in hind then copy and paste them on the browser
u dont have to download the fonts
|
|
|
|
|
i am using the below sample code for sort in repeater, it is sorting only in asc order, now i want to sort both direction, i am using defaultview.sort, using the same function
can anyone help me
Thankz
connection open()
strSql = "select fiel1,fie2 from tablename order by columname or (Request.QueryString("val"))"
Dim da As New OleDbDataAdapter(strSql, connection)
Dim ds As New DataSet
da.Fill(ds)
If Request.QueryString("val") = "" Then
repeater.DataSource = ds.Tables(0)
Else
ds.Tables(0).DefaultView.Sort = Request.QueryString("val")
repeater.DataSource = ds.Tables(0).DefaultView
repeater.DataBind()
End If
connectionclose()
|
|
|
|
|
Use your sql query in the followign manner it will sort the records in desecding order.
order by columname desc
The desc keyword followed by the column will arange the data into desecding order
with regards
Yogesh Agarwal
|
|
|
|
|
<br />
ds.Tables[0].DefaultView.Sort = Request.QueryString("val") + "desc";<br />
But you will probably want to add someway to toggle between asc and desc.
|
|
|
|
|
hi friend i want to convert any music file to.mp3 format .
how to do it. can i use window's service for .
If yest how do i do this. ( I am new to windows service pls tell me how will i set time to execute window's service )
thanks in advance.
|
|
|
|