|
The length of the value that you are going to put in the column is exceeding the size of the column. Just compare the lentgh of the value with the columns data size.
There is no foolish question, there is no final answer...
|
|
|
|
|
|
What is this ? Cheers !
Abhijit
Codeproject MVP
|
|
|
|
|
And the point of your posting is what? Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
|
%@ Control Language=”C#” ClassName=”RandomImage” %;
is this directive wrong?
wen am specifying this it is giving me a error.
|
|
|
|
|
sowjanya3 wrote: wen am specifying this it is giving me a error.
Please let us know which error are you getting ?Cheers !
Abhijit
Codeproject MVP
|
|
|
|
|
it says that attribute control is not valid attribute of element page
|
|
|
|
|
Hi,
I am creating a new setup page where I am trying to have a user add new setup values. These values have a unique identifier id (like HEAD01, HEAD02 and so forth - which happens to be the primary key in that record) which I have to generate using code.
Here I am trying to use a detailsview object with the New/Update/Delete option.
Here if the user Chooses to Add a new value, I need to determine the next unique identifier for this new value to be added (say HEAD16) by looking at the last generated number in that table and have this new value added in the database. The user should not be able to give this primary key value manually it should be autogenerated by code.
Can you help me on how to do this?
I am using SQLDataSource with Detailsview to add update values.
Rikhav
|
|
|
|
|
Hello -
do you guys know if there are some webservices out there which we can call for getting tracking info for shipped items?
Thx, Laziale
|
|
|
|
|
Nope,
Without limitation, you are not authorized to make the Information available on any web site or otherwise reproduce, distribute, copy, store, use or sell the Information for commercial gain without the express written consent of UPS.
They want you to use their products to do it. See the "Integrate Tracking Tools" section of their tracking page[^]
|
|
|
|
|
Thanks for your answer.
So in order to use the ups tracking code webservice I will need to contact UPS or...?
|
|
|
|
|
Hello,
I have a asp.net website and a C# web page and I am calling a stored procedure to return the email address of the user that is logged in.
I have debugged my code and am presented with the following error message.
Cannot implicitly convert type 'System.Data.SqlClient.SqlParameter' to 'string'
Any assistance you can provide would be much appreciated.
My code for the web page class and my code for the stored procedure are below.
Thank you,
Allison
EmailTo Class
<br />
public class EmailTo<br />
{<br />
public string getEmailTo() <br />
{<br />
<br />
using (System.Data.SqlClient.SqlConnection myConnection = new<br />
System.Data.SqlClient.SqlConnection(ConfigurationManager.<br />
ConnectionStrings["ConnectionString2"].ConnectionString))<br />
{<br />
System.Data.SqlClient.SqlCommand myCommand2 = new System.Data.SqlClient.SqlCommand();<br />
myCommand2.CommandText = "usp_get_email_to";<br />
myCommand2.CommandType = CommandType.StoredProcedure;<br />
myCommand2.Connection = myConnection;<br />
<br />
SqlParameter returnEmail = new SqlParameter("Email", SqlDbType.NVarChar);<br />
returnEmail.Direction = ParameterDirection.ReturnValue;<br />
myCommand2.Parameters.Add(returnEmail);<br />
<br />
<br />
myConnection.Open();<br />
myCommand2.ExecuteNonQuery();<br />
myConnection.Close();<br />
<br />
return returnEmail;<br />
<br />
<br />
}<br />
}<br />
}<br />
<br />
Stored Procedure
<br />
CREATE PROCEDURE dbo.usp_get_email_to<br />
<br />
@Email nvarchar(256),<br />
@UserId uniqueidentifier<br />
<br />
AS<br />
<br />
SET @Email = (SELECT Email FROM aspnet_Membership<br />
WHERE UserId=@UserId)<br />
<br />
<br />
RETURN @Email<br />
GO<br />
<br />
<br />
|
|
|
|
|
ahayw01 wrote: SqlParameter returnEmail = new SqlParameter("Email", SqlDbType.NVarChar);
returnEmail.Direction = ParameterDirection.ReturnValue;
myCommand2.Parameters.Add(returnEmail);
1. parameter should start with '@'
SqlParameter returnEmail = new SqlParameter("@Email", SqlDbType.NVarChar);
2. parameter value is missing - add this below line before adding the parameter to myCommand2
returnEmail.Value = "abc@codeproject.com"
|
|
|
|
|
Sandeep,
Thank you so much for your quick response.
I am a little confused about step 2. I think that I may not have been clear in my initial post.
The returnEmail.Value should be pulling from the value that is stored in the sql table.
However, I had thought that the existing code will account for that
<br />
returnEmail.Direction = ParameterDirection.ReturnValue;<br />
myCommand2.Parameters.Add(returnEmail);<br />
Any additional suggestions would be appreciated. My apologies for any confusion.
Allison
|
|
|
|
|
Did you tried adding '@' before the parameter Email?
|
|
|
|
|
Furtherm, Where from your @UserID parameter is supplied? Shouldn't that too be added in the Command Parameters?
|
|
|
|
|
Hello,
Thanks yes, I did apply step 1. And was still receiving the same error message.
However, just tried and tested the following and now it works
return returnEmail.Value as String;
Thanks again for your help,
Allison
|
|
|
|
|
|
I have DataView control with paging on an asp.net webpage. I have been asked if it is possible to default the DataView to the last page, rather than page 1.
So I tried this :-
Protected Sub telemetryGridView_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles telemetryGridView.PreRender
If Not IsPostBack Then
telemetryGridView.PageIndex = telemetryGridView.PageCount - 1
telemetryGridView.DataBind()
End If
End Sub
I read somewhere that after setting the PageIndex I would need to call the DataBind method of the GridView .
The result is that the GridView still defaults to page 1.
Can anyone enlighten me as to where I am going wrong?
ThanksSteve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
This code looks ok. Now are you rebinding the grid again after this? Try VS debugger and see if your grid is getting re-bind somewhere else after this?
Also, try using the above code in Page Prerender instead of controls pre-render.
|
|
|
|
|
- Solution (same i am doing on page load it works)
Public Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
telemetryGridView.DataBind()
telemetryGridView.PageIndex = telemetryGridView.PageCount
End If
End Sub
In short you have to set max index after binding the datagrid, in your case pre render
GridName.DataBind()
GridName.PageIndex = GridName.PageCount
|
|
|
|
|
- Solution (same i am doing on page load it works)
Public Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
telemetryGridView.DataBind()
telemetryGridView.PageIndex = telemetryGridView.PageCount
End If
End Sub
In short you have to set max index after binding the datagrid, in your case pre render
GridName.DataBind()
GridName.PageIndex = GridName.PageCount
|
|
|
|
|
Hello,
I want to create if statement in the html part of my site. Can someone help me with that and give me some example.
I have a label and depending from the text, the forecolor to be different.
Here is what I have:
<asp:Label ID="lblFirstName" runat="server" Text='<%#Server.HtmlEncode(Eval("FirstName").ToString())%>'></asp:Label>
So depending on the text, for example if the text contains 'John' text will be in red, if the text contains 'Jim' text will be in blue.
Thanks for any advice,
Laziale
|
|
|
|
|
May I ask why particularly it needs to be in the html code for the page? Are you prevented from altering code behind?
|
|
|
|