|
I have created a web form,but i have small problem,i need to retreive records from database according to ID which i given in the form in text box,i have created the StoredProcedure for that one its retreive data and i put where fieldname=@ID.
When i'm using datagrid or GridView this will not occour,but i need to do in using text box.Please help me to do this
Thank You
|
|
|
|
|
What is the question ? You need to write the SQL, which is basically select * from tbl where fieldname = id. Sounds like you did that. So, you get the id from the textbox, and pass it to the proc, set your datasource with the result, and databind.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Ok but how do i pass my text value into StoredProcedure and i'm using DataReaders.
Note-:Can i use SqlParameter for this one,if yes,how to do that.
|
|
|
|
|
SqlParameter[] param = new SqlParameter[1];
param[0] = new SqlParameter("@<your param="" name="">", SqlDbType.NVarChar, 50);
param[0].Direction == ParameterDirection.InputOutput;
param[0].Value=<your value="">;
//Add the parameters to the command object
objcommand.Parameters.Add(param);
objcommand.CommandType=CommandType.StoreProcedure;
objcommand.Connection=<conn object="">;
objcommand.Command="Stored Proc Name";
objcommand.ExecuteNonQuery();
Kiran Kumar.CH
(MCP)
|
|
|
|
|
Hi,
first write one storedProc for Select data from DB with ID, Here is the Stored Procedure .
Create Procedure nameofStoredProcedure
(
@ID
)
AS
select *
from table
where id=@ID
ADO.NEt code
SqlConnection Con=new SqlConnection("userid="";databse=""; password="");
con.Open();
SqlCommand cmd=new SqlCommand("nameofStroredProcedure",con);
cmd.CommandType=CommandType.StoredProcedure;
cmd.parameter.add(new Sqlparameter("@ID",SqlDbType.Varchar(10));
cmd.parameter[0].value=textbox1.text;
SqlDataAdapter da=new SqlDataAdapter();
da.selectCommand=cmd;
da.fill(ds,"tablename");
con.Close();
i hope this will helpful for u, try onces.
WINNING IS NOT OUR DREAM,IT'S A HABIT
HAVE A NICE DAY
|
|
|
|
|
dornala wrote: Create Procedure nameofStoredProcedure
(
@ID
)
Incorrect syntax - you need to specify the datatype
dornala wrote: SqlConnection Con=new SqlConnection("userid="";databse=""; password="");
Incorrect syntax - check your quotes
dornala wrote: cmd.parameter.add(new Sqlparameter("@ID",SqlDbType.Varchar(10));
Incorrect syntax - it should be
cmd.parameter.add(new Sqlparameter("@ID",SqlDbType.VarChar,10));
|
|
|
|
|
J4amieC wrote: Incorrect syntax - it should be
cmd.parameter.add(new Sqlparameter("@ID",SqlDbType.VarChar,10));
Well actually it should be
cmd.Parameters.Add(new SqlParameter("@ID",SqlDbType.VarChar,10));
:P
Also instead of using
cmd.parameter.add(new Sqlparameter("@ID",SqlDbType.Varchar(10));<br />
cmd.parameter[0].value=textbox1.text;
as described in the previous post, it would be much easier to use:
cmd.Parameters.Add("@ID", textbox1.Text);
(AddWithValue in 2.0)
Just my daily cup of being a smartass.
|
|
|
|
|
Hi
Thank you freind Its working fine.
|
|
|
|
|
Hi All I am Opening A popup Window For Save n Open File...
My Code Is ......
**************************************************
<%@Language="VBScript"%>
<%
Option Explicit
Dim objStreamNew
Dim strFilename
dim strPath
strFilename = Request.QueryString("fileN")
Set objStreamNew = Server.CreateObject("ADODB.Stream")
objStreamNew.Type =1
objStreamNew.Open
strPath = server.MapPath("/writereaddata")
objStreamNew.loadFromFile(strPath & "\"&strFilename)
Response.ContentType = "application/unknown"
Response.addHeader "content-disposition", "attachment;filename=" & Chr(34) & strFilename & Chr(34)
Response.BinaryWrite objStreamNew.Read
objStreamNew.Close
Set objStreamNew = Nothing
%>
****************************************************
Now I Am Getting ..
Provider error '8007000e'
Not enough storage is available to complete this operation.
/elekha/SaveAsNew.asp, line 13
.
I Have Search out All Google Result ..but didn't get Solution ..Please Tell Me solution ..
Thanksyou In Advance
Life is not easy ,let's make it.
|
|
|
|
|
This is the ASP.NET forum, try the web development forum.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Hi to all
i have 3 dropdownlist on asp.net page and try to validate (required field validation) BUT it is not working on submit button.
plz. tell me how to validate dropdownlist?
John
|
|
|
|
|
have u set the Initial value property of required field validator...
if not then assign it to value of first item of dropdownlist control..
There's never a Wronge Time To Do The Right Thing !!
|
|
|
|
|
Hi,
In web application using Asp.net 2.0 and c# .
I have written code for Cropping images .It is working fine in IE Browser. But giving exception as "Parameter not valid "
in
" System.Drawing.Bitmap thumbBitmap = new System.Drawing.Bitmap(fs, true); "
statement of following code snippet .
I dont understand how to solve this problem.
(Or you can suggest some another way of cropping images that doesn't use System.Windows namespace.)
Please Guide.
Code:
FileStream fs = new FileStream(FileUpLd.PostedFile.FileName, System.IO.FileMode.OpenOrCreate);
System.Drawing.Bitmap thumbBitmap = new System.Drawing.Bitmap(fs, true);
thumbBitmap = (Bitmap)thumbBitmap.GetThumbnailImage(75, 75, new System.Drawing.Image.GetThumbnailImageAbort(ThumbCollback), IntPtr.Zero);
Context.Response.ContentType = "image/Jpeg";
thumbBitmap.Save(Server.MapPath("") + "\\Images\\ProfileImages\\" + FileNameOnServer, System.Drawing.Imaging.ImageFormat.Jpeg);
thumbBitmap.Dispose();
fs.Close();
yog
hui gfgh kgdgrt njjn hjgkn
|
|
|
|
|
try this
Bitmap bm = new Bitmap( Server.MapPath("b2346.jpg"));
Response.Write ("Height :" + bm.Height.ToString() );
Response.Write (" Width :" +bm.Width.ToString() );
|
|
|
|
|
How can i unzip the zip file during the uploading.....
acutally i need to upload a zip file and when user upload zip file and click Upload button, the function unzip the folder first and then save it at desired location.
Feroze
|
|
|
|
|
Hi All,
Can any one tell me hw to disable the close, minimize buttons of title bar in browser with the help of javascript. Or how to remove the title bar from browser.
Code:
str = "window.open('previous.aspx','','location=0,resizable=0,ScrollBars=1,statusbar=1,TitleBar=0,width=680,height=600'); "
Page.RegisterStartupScript("abc", str)
|
|
|
|
|
You can't disable the buttons, and I doubt you can remove the title bar, perhaps in a popup.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
hi all!
i need some help from u guys..im just startin off with the desingnin and coding for a project that is mandatory within the curriculum of a .net course im doin at a local institute..the topic ive suggested is an airline information and reservation system..my basic plans are to start off with the designing of webforms(asp.net), tables using sql server 2000 and some front page postings..anyways hope u guys can provide me with a better start and implementation..thankyou..cya
|
|
|
|
|
You should probably design the screens first, then think about how the data layer should be put together. That will make your business needs clearer. Beyond that, it's hard to give advice on such a broad question.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
I`ve an asp.net project with lots of query strings, now can i secure all query strings (i mean encryption/decryption) using any procedure? i dont want to touch the code. Is there any easy way using IIS/web.config or whatever to secure all query strings of the project without affecting code?
|
|
|
|
|
May be u can remove the address bar of IE...
|
|
|
|
|
Goto IIS>Rightclick on your project>properties>DirectorySecurity>Edit Secure communications.
>check the first option(Require Secure Channel).
>check the accept client certificates.
Kiran Kumar.CH
(MCP)
|
|
|
|
|
why the edit button is disabled on my machine ??
When you get mad...THINK twice that the only advice
Tamimi - Code
|
|
|
|
|
Hi all,
I want create year calendar means show all months
i am using asp.net
thanks,
|
|
|
|
|
What exactly u want to do???U want to give year scroll to calender control or u want to display all months of any year???
|
|
|
|