|
Hi Everyone,
I need to capture the data from the out parameter of a stored procedure.
str = "{call <Mainframe-SPname>(<Parameters>)}"
Can anyone help me in this regard
-- modified at 3:02 Wednesday 22nd August, 2007
Regards,
Manowj
|
|
|
|
|
I have no idea about IBM DB2.
For SQL, it will be like that.
SqlConnection dbConn = new SqlConnection ("connectionstring");<br />
dbConn.Open ();<br />
SqlCommand cmd = new SqlCommand ();<br />
cmd.Connection = dbConn;<br />
cmd.CommandText = "mystoreProcedureName";<br />
cmd.CommandType = CommandType.StoredProcedure;<br />
SqlParameter param = new SqlParameter();<br />
param.Direction = ParameterDirection.Output;<br />
param.ParameterName = "paramOut";<br />
cmd.Parameters.Add (param); <br />
cmd.ExecuteNonQuery ();<br />
cmd.Dispose ();<br />
dbConn.Close ();
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
I am trying to build a list of items with checkboxes so that the users can remove several items from the list simultaneously. I have the list with the checkboxes displaying correctly. When I select a few items and click the remove button, event does not seem to be able to recognize that the items were selected.
I placed a blank table and CheckBoxList control on my page. I build the table to display the list during the Page_Load event. The list with checkboxes seems to work ok. When the RemoveItems_Click event fires, it cyles through the CheckboxList but it doens't recognized the Selected attribute so that I can remove the items.
Here are the relevant code snippets. Thanks for any feedback!
<asp:table id="ViewTable" runat="server">
<asp:checkboxlist id="RemoveItemsCheckBoxList" runat="server"
="" visible="False">
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
GetItemLists(RemoveItemsCheckBoxList);
}
}
public static void GetItemLists(CheckBoxList checkBoxList)
{
// Connect and fetch data
while (sqlDataReader.Read())
{
// build the ViewTable
// now create the checkbox and add it to the table
CheckBox checkBox = new CheckBox();
checkBox.ID = "RemoveCheckbox" + sqlDataReader["Id"].ToString();
checkBoxList.Items.Add(checkBox.ID.ToString());
cell = new TableCell();
cell.Controls.Add(checkBox);
row.Cells.Add(cell);
}
// clean up
}
protected void RemoveItemsButton_Click(object sender, EventArgs e)
{
foreach (ListItem listItem in RemoveItemsCheckBoxList.Items)
{
if (listItem.Selected == true)
{
// Remove the Item
...
}
}
|
|
|
|
|
I think you need to set AutoPost to true.
CheckBoxList1.AutoPostBack = true;
Hope it helps.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Hi!
I need some assistance.
I am using ASP.NET 2.0 Login Controls for my site and Roles are enabled. My problem is that I have a form with a dropdownlist. When a person signs on and he is in Role1 than all Role1 users must be displayed in the dropdown. If Role2 signs on then everyone from Role2 must be displayed.
Much appreciated!
Illegal Operation
Making Computer Software Talk
|
|
|
|
|
What is the life cycle of asp.net page
|
|
|
|
|
|
One of the most confusing things in ASP.NET
picture (big)[^]
[ My Blog] "Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
in addition to michael's answers..
http://www.15seconds.com/Issue/020102.htm
http://www.c-sharpcorner.com/UploadFile/Santhi.M/ASP.NETLifeCycle11282005043446AM/ASP.NETLifeCycle.aspx
suggestion:google to these kind of topics
|
|
|
|
|
Hello friends,
I have to start one new project,
Automatic installation of mysql db in the local machine, the function is when the exe is run.The programm should automatically detect if My sql db is alreadyy installed, if not installed then the Mysql setup file will run automatically
Please let me know how to work on this project, anybody have sample code please give and help me...
Thanks
Praveen Kumar.R
|
|
|
|
|
In your program start ODBC connection to my sql server. If MySQL service is not running, it will throw exception. Catch it and initialize MySQL setup file. Are you trying to do this on ASP.NET ?
|
|
|
|
|
hi, i am using a library to allow users to upload files through the application, it was working well but when my host provider changed the domain address, i also changed my code to fit the new one but it works with some and others it gives me an error of
(Cannot find part of the path......) or (cannot find file windows/system32/...)
please help me
thanks
abdelhameed81
|
|
|
|
|
Are you using "server.mappath" to specify your directory? Without seeing your code, the best I can do is provide an example of a solution I'm using that uploads successfully. In this sample, I upload the file into an "Uploads" folder on my server:
.aspx file:
-----------------------------------------------------------
<TR>
<TD class=td7_c align=right></TD>
<TD align=left><asp:FileUpload ID="fu_File1" runat="server"/></TD>
</TR>
<TR>
<td></td>
<td align="right">
<asp:Button ID="btnUpload" runat="server" OnClick="btnUpload_Click" Text="Upload"></asp:Button>
</td>
</TR>
-----------------------------------------------------------
.cs codebehind file:
-----------------------------------------------------------
#region Click Events
protected void btnUpload_Click(object sender, EventArgs e)
{
string targetDirectory;
if (fu_File1.HasFile)
{
targetDirectory = Server.MapPath(@"Uploads/" + fu_File1.FileName);
fu_File1.SaveAs(targetDirectory);
string dir = fu_File1.PostedFile.FileName;
Response.Write(dir);
}
}
#endregion
--------------------------------------------------------------
Hope that helps.
-Goalie35
|
|
|
|
|
Hi All,
I want to validate textbox in gridview for phone number through Javascript only. How can do this
Thanks!
|
|
|
|
|
swami samarth wrote: I want to validate textbox in gridview for phone number through Javascript only. How can do this
You can add a Custom Validator which points to that textbox in the template column of GridView. then, call the javascript function from GridView.
DEMO
The following code is for Server-side ~
using System;<br />
using System.Data;<br />
using System.Configuration;<br />
using System.Collections;<br />
using System.Web;<br />
using System.Web.Security;<br />
using System.Web.UI;<br />
using System.Web.UI.WebControls;<br />
using System.Web.UI.WebControls.WebParts;<br />
using System.Web.UI.HtmlControls;<br />
using System.Collections.Generic;<br />
<br />
public partial class Default2 :System.Web.UI.Page {<br />
protected void Page_Load(object sender, EventArgs e)<br />
{ <br />
System.Collections.Generic.List<string> s = new List<string>();<br />
s.Add("Ruby");<br />
s.Add("Diamond");<br />
s.Add("Gold");<br />
GridView1.DataSource = s;<br />
GridView1.DataBind ();<br />
}<br />
<br />
}<br />
I will post the HTML code in next thread. (otherwise, i will lose the formatting here.)
Note: isValidPhoneNumber is a javascript function to check phone number. I set this code ClientValidationFunction="isValidPhoneNumber" ControlToValidate="TextBox1" in custom validator which is put in the template column of GridView. Textbox1 is a textbox which is put in the template column of GridView.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<meta http-equiv="cache-control" content="no-cache">
</head>
<body>
<script language="javascript" type="text/javascript">
function isValidPhoneNumber(sender, args){
if(args.Value == "something")
args.IsValid = true;
else
args.IsValid = false;
}
</script>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server" Width="249px">
<Columns>
<asp:TemplateField HeaderText="1">
<ItemTemplate>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:CustomValidator ID="CustomValidator1" runat="server" ClientValidationFunction="isValidPhoneNumber"
ControlToValidate="TextBox1" ErrorMessage="CustomValidator"></asp:CustomValidator>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="2">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="3"></asp:TemplateField>
</Columns>
</asp:GridView>
<asp:ValidationSummary ID="ValidationSummary1" runat="server" />
<asp:Button ID="Button1" runat="server" Text="Button" /></div>
</form>
</body>
</html>
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Hi,
I am using the TabContainer, in which I have 6 tabpanels. On page load I want to visible only first 4 Tabpanel. and remaining two should be invisible.
How can I do this at runtime.
Thanks!
|
|
|
|
|
It will be something like this:
In the PageLoad put this,
IF(Page.IsPostback)
{
Panel1.visible = "True"
Panel2.visible = "True"
Panel3.visible = "True"
Panel4.visible = "True"
Panel5.visible = "False"
Panel6.visible = "False"
}
Else
{
}
You can also use the Select Case for this.
Hope it helps!
Illegal Operation
Making Computer Software Talk
|
|
|
|
|
how can i create a .pdf file. I have a string with a html code. I need to make a .pdf file using that code.How can i make without using third party .dll. Is it possible to make by saving as .pdf, but i try and i didt got.
Thks
|
|
|
|
|
ypki wrote: How can i make without using third party .dll
You can study the pdf file format and then learn how to write your own third party dll.
ypki wrote: Is it possible to make by saving as .pdf, but i try and i didt got.
If you create a text file, called 'world of warcraft.txt', and you change the extension to .exe. will it run ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
so u mean without a .dll we cant make a .pdf file ??
.txt,.xls,.doc etc all can make by saving corresponding extentions, .pdf cant..ryt??
|
|
|
|
|
ypki wrote: so u mean without a .dll we cant make a .pdf file ??
Understand PDF file structure and write your own library to do this
|
|
|
|
|
ypki wrote: .txt,.xls,.doc etc all can make by saving corresponding extentions, .pdf cant..ryt??
Wrong. To create an xls or a doc, you can interop Office, which will create the files for you, otherwise you need to write the code yourself, in a dll or otherwise. But, no file format is natively supported by .NET except for XML, in that there's an XML writer which does help ensure your tags are closed.
The fact that you think you can rename a file to .pdf and it becomes one, indicates that you really don't understand what is going on, I'd recommend you do some serious reading here, not just about pdf, but about the nature of what it is that you're doing in general.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
Hello,
This is starting to really bug me. If I make a call to a function from the Page_Load it does what it supposed to do, but if I make the same call from a control on the page it does not work properly.
I am trying to create a function that dynamically creates drop down lists, bound to a db, and then sets the "onchange" property so that when the user changes the selected item it posts back and executes code on the server side. Here's my code behind:
<br />
using System;<br />
using System.Data;<br />
using System.Configuration;<br />
using System.Collections;<br />
using System.Web;<br />
using System.Web.Security;<br />
using System.Web.UI;<br />
using System.Web.UI.WebControls;<br />
using System.Web.UI.WebControls.WebParts;<br />
using System.Web.UI.HtmlControls;<br />
<br />
public partial class testcode : System.Web.UI.Page<br />
{<br />
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
DropDownList ddl1 = new DropDownList();<br />
ddl1.Items.Add("Item1");<br />
ddl1.Items.Add("Item2");<br />
ddl1.AutoPostBack = true;<br />
form1.Controls.Add(ddl1);<br />
ddl1.SelectedIndexChanged += new EventHandler(ddl_SelectedIndexChanged); <br />
}<br />
protected void x(object sender, EventArgs e)<br />
{<br />
DropDownList ddl2 = new DropDownList();<br />
ddl2.Items.Add("1");<br />
ddl2.Items.Add("2");<br />
ddl2.AutoPostBack = true;<br />
form1.Controls.Add(ddl2);<br />
ddl2.SelectedIndexChanged += new EventHandler(ddl_SelectedIndexChanged);<br />
}<br />
void ddl_SelectedIndexChanged(object sender, EventArgs e)<br />
{<br />
<br />
<br />
Response.Write("works");<br />
}<br />
}<br />
And my .aspx:
<br />
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="testcode.aspx.cs" Inherits="testcode" EnableViewState="true" %><br />
<br />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><br />
<br />
<html xmlns="http://www.w3.org/1999/xhtml" ><br />
<head runat="server"><br />
<title>Untitled Page</title><br />
</head><br />
<body><br />
<form id="form1" runat="server"><br />
<asp:Button runat="server" Text="Push Me" OnClick="x" /> <br />
</form><br />
</body><br />
</html><br />
The dropdownlist that is created on page load works fine, and upon changing the selected item from this dropdownlist it is able successfully call the correct function. However, the dropdownlist created by the button is not able to call the function properly, it just causes a page reload, and the second dropdownlist created by the button dissapeasrs. Any help would be greatly appreciated!
Thanks,
Shivam.
-- modified at 2:37 Wednesday 22nd August, 2007
|
|
|
|