|
HI
Plse help me in binding two table vlues into a crystal report..
I am not able to populate dataset with these two tables..
try until u succeed
|
|
|
|
|
Hi,
you create a new temp table C in stored procedure with table A columns and table B columns and insert the values into that C using results of A and B tables and return that table C to the dataset.So that dataset will have only one table.
In a nutshell merge two tables into one table.
Kiran Kumar.CH
(MCP)
|
|
|
|
|
Hi all....
i need to upload Excel file and save it into database. If anyone have code plz send me. it very urgent.
Suresh.R
|
|
|
|
|
You can store the binary content right? You should try doing a quick search for storing and retrieving images from sql server and you may like to do the same trick.
|
|
|
|
|
Hi,
I always get this error when i use events for controls in aspx, events like onClick(), checkedChanged(), ..
If I remove that event from aspx the error disappears, pls find the error details below.
<asp:Button id="Button1" style="Z-INDEX: 101; LEFT: 16px; POSITION: absolute; TOP: 96px" runat="server"
Text="Button" OnClick="NumericOnly_onkeypress(event)"></asp:Button>
I tried giving semi-colon after the function name like:
OnClick="NumericOnly_onkeypress(event);"
still i get this error. Has anyone come across this error?
Reagrds,
Blumen
|
|
|
|
|
HI Blumen,
I am not sure but try like this..
<asp:button id="Button1" style="Z-INDEX: 101; LEFT: 16px; POSITION: absolute; TOP: 96px" runat="server"
text="Button" onclick="NumericOnly_onkeypress">
Kiran Kumar.CH
(MCP)
|
|
|
|
|
Then I get the error saying that, this aspx does not contain a definition for "NumericOnly_onkeypress". This happens with RadioButton and CheckBox also, when i use its CheckedCHanged event
|
|
|
|
|
Make sure that autoeventwireup at page attribute is turned off i.e make it false if you are using IDE.
Make sure that "NumericOnly_onkeypress" event handler has correct arguments i.e
void NumericOnly_onkeypress(sender as object,e as EventArgs)
{
}
Tell me where you are writing this handler either in code behind i.e .cs file are inpage i.e in aspx file?
Kiran Kumar.CH
(MCP)
|
|
|
|
|
<blockquote class="FQ"><div class="FQA">kiran kumar[Intelligroup] wrote:</div>Make sure that autoeventwireup at page attribute is turned off</blockquote>
It was turned off already, still same error
<blockquote class="FQ"><div class="FQA">kiran kumar[Intelligroup] wrote:</div>Tell me where you are writing this handler</blockquote>
in aspx
This is the function:
function NumericOnly_onkeypress()
{
if(window.event.keyCode<48 || window.event.keyCode>57 )
{
window.event.keyCode=false;
return false;
}
}
Regards,
Blumen
|
|
|
|
|
if you are using asp.net 1.1 do this way
remove onclick="NumericOnly_onkeypress" in aspx file and write
the statement like this in .cs file page load event
buttion1.attributes.add("onclick","NumericOnly_onkeypress");
if you are using asp.net 2.0 you can
write like this
Text="Button" önClientClick="NumericOnly_onkeypress">
Kiran Kumar.CH
(MCP)
|
|
|
|
|
Thanks Kiran, that did the trick for TextBox keypress event, but for Radiobutton and CheckBox, the function in aspx is not firing:
I gave it like this:
rbn1.Attributes.Add("OnCheckedChanged", "Onkeypress(this)");
rbn2.Attributes.Add("OnCheckedChanged", "Onkeypress(this)");
function Onkeypress(thiss)
{
if (document.getElementById (thiss.id).checked == true)
alert("checked");
}
Why does it work when I hook the event handler as an attribute? And why doesn't it work for RadioButton and CheckBox?
Regards,
Blumen
|
|
|
|
|
Now it will work because OnCheckedChange is serverside event.but your function is at client side naa so write like this
rbn1.Attributes.Add("onclick", "Onkeypress(this)");
rbn2.Attributes.Add("onclick", "Onkeypress(this)");
Kiran Kumar.CH
(MCP)
|
|
|
|
|
You are getting the server-side and client-side events mixed up. For an <asp:Button> OnClick is the server side event (and expects a function name that is in your code behind) and OnClientClick is where you can put client-side javascript calls (this attribute simply expects a string). Have a look at the MSDN documentation for more.
|
|
|
|
|
I couldn't find OnClicntClick for CheckBox and RadioButton, what do we do in that case?
|
|
|
|
|
Hi,
This is my first time trying stored procedures on ASP.NET using C# but I am having some problem with the return value. Here is my stored procedures
CREATE PROCEDURE IsValidLogin
(
@username varchar(15) = NULL,
@password varchar(12) = NULL ,
@num_of_user INT = 0
)
AS
BEGIN
SET @num_of_user = (SELECT COUNT(*) AS num_of_user
FROM tb_user
WHERE useremail = @username AND userpassword = @password)
RETURN @num_of_user
END
GO
Then here is my code (btw, this is for login)
try
{
if (myConnection.State == ConnectionState.Closed)
{
myConnection.Open();
}
myCommand = new SqlCommand("IsValidLogin", myConnection);
myCommand.CommandType = CommandType.StoredProcedure;
SqlParameter objParam1, objParam2, objParam3;
objParam1 = myCommand.Parameters.Add("@username", SqlDbType.VarChar);
objParam2 = myCommand.Parameters.Add("@password", SqlDbType.Char);
objParam3 = myCommand.Parameters.Add("@num_of_user", SqlDbType.Int);
objParam1.Direction = ParameterDirection.Input;
objParam2.Direction = ParameterDirection.Input;
objParam3.Direction = ParameterDirection.ReturnValue;
objParam1.Value = this.TextBox1.Text;
objParam2.Value = this.TextBox2.Text;
myCommand.ExecuteNonQuery();
Response.Write(objParam3.Value);
}
catch(Exception exception)
{
throw exception;
}
finally
{
myConnection.Dispose();
myConnection.Close();
}
It keep on returning '0' whiich I don't know where it gone wrong.
Your help is much appreciated.
Thank you.
J Liang
|
|
|
|
|
J Liang wrote: RETURN @num_of_user
Try SELECT @num_of_user
|
|
|
|
|
Hi,
Do you mean doing SELECT @num_of_user instead of SELECT COUNT(*) AS num_of_user?
If it is, I don't think I could not select @num_of_user as it is suppose to capture the return value from the stored procedure and show it back to me.
Sorry if I did not get what you mean.
J Liang
|
|
|
|
|
Hi,
try this way...
SET @num_of_user = SELECT COUNT(*) FROM tb_user
WHERE useremail = @username AND userpassword = @password)
RETURN @num_of_user
Kiran Kumar.CH
(MCP)
|
|
|
|
|
Hi Kumar,
I'd tried, but the result is still the same, it returns the same value no matter what I type my username and password are.
J Liang
|
|
|
|
|
CREATE PROCEDURE IsValidLogin<br />
(<br />
@username varchar(15) = NULL,<br />
@password varchar(12) = NULL ,<br />
@num_of_user INT = 0 --This means that it's an input parameter<br />
)<br />
Try
CREATE PROCEDURE IsValidLogin
(
@username varchar(15) = NULL,
@password varchar(12) = NULL ,
@num_of_user INT = 0 OUTPUT
)
--Your SET statement here
--No need for a RETURN statement
(OR)
In your C# code
int retVal;<br />
retVal = myCommand.ExecuteNonQuery();
Remember:
If you want any custom output from your SP, use an OUTPUT parameter. By default an SP returns 0 if it was successful and non-zero in case of failure. This must be used exclusively for error checking.
SG
|
|
|
|
|
Hi i_like_tintin,
I tried your way and the retVal keep on returning -1 value. So I tried to display the objParam3.Value which I declare as objParam3.Direction = ParameterDirection.Output; and it return '0' to me no matter my username and password are correct.
|
|
|
|
|
Execute your SP in Query Analyzer and check if it works without errors for different sets of input.
SG
|
|
|
|
|
Hi using place holder & literal control,i created textbox in runtime...,
That code is:
In page load event:
Dim intcount As Integer
If Not IsPostBack Then
ViewState("BookFieldCount") = 1
ElseIf viewstate("BookFieldCount") > 1 Then
For intcount = 2 To viewstate("BookFieldCount")
addbookfield(intcount)
Next
End If
And in button click event:
viewstate("BookFieldCount") += 1
addbookfield(viewstate("bookfieldcount"))
and in "addbookfield" call procedure:
Sub addbookfield(ByVal strfieldnum As String)
Dim litlabel As LiteralControl
Dim txttextbox As TextBox
litlabel = New LiteralControl
litlabel.Text = "
Mark " & strfieldnum & ":"
plhbookfields.Controls.Add(litlabel)
txttextbox = New TextBox
txttextbox.ID = "txtproduct" & strfieldnum
plhbookfields.Controls.Add(txttextbox)
End Sub
After this code
if click the button u will get runtime textbox in ur screen...,
Now my ques is:
In runtime textbox if i enter values, how to add those values to my database?,
Normally with the id of the textbox we can add the values to tables...,
But in runtime textbox where we will get the id and how to add those values to my tables...,
Plz help me...
Magi
|
|
|
|
|
Hi,
When we are creating text box at runtime.
We can use the the object the text box.
but here You used same object "txttextbox" so you can
use "FindControl" method and assign it to a textbox and retrieve the
value.
Magh_M wrote: txttextbox.ID = "txtproduct" & strfieldnum
here u are assigning id to text box.U can use this ID inside FindControl.
To succeed, we must first believe that we can.
Sherin Iranimose
|
|
|
|
|
If u dont mind plz explain some what more...,
How to do that?
Magi
|
|
|
|