|
If a string contains quotes - which are interpretted by the compiler as start/end of string - you have to escape them to tell it that they are part of the string and not delimiting it.
Don't know about C, but in VB you can do this by by sinply doubling them - viz:
Dim str As String = ds.Tables[0].Rows[1][1].ToString.Replace(Chr(34), Chr(34) & Chr(34))
(Since Chr(34) = the quote character)
Hope that helps
Phil
|
|
|
|
|
This doesn't seem to help, im afraid.
istead the following seems to be a step to the solution
char[] strArr = ds.Tables[1].Rows[1][1].ToString().ToCharArray();
here strArr doesn't have the extra slashes or quotes, but now how to use this char array instead of string in my code.
As casting it back to string will get me the string with extra slashes as before.
|
|
|
|
|
I'm using AJAX to write Web application, there have two client (client1, client2) and server. Now i use XmlHttpRequest to send request to Server from Client1, after that, i want server send the response to Client2. But if i use Response.write(something here), Server always send to Client1, not Client2. How can i do???
Thanks!
|
|
|
|
|
You can't do that. The HTTP protocol simply doesn't work that way. You have to send a request from the client to be able to send a response back from the server.
---
b { font-weight: normal; }
|
|
|
|
|
So are there any way to do that? example some game online ?
|
|
|
|
|
Just do a request every N seconds that will ask the server if it has anything for the client. Of course you will have to write the code at the server side that will be able to do that.
But if you will only have two clients then you should defenitly write a windows application!
--------------------------------------------------------
My development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
hey
i'll know how i can catch error in asp.net DADAX
-- modified at 13:51 Sunday 23rd April, 2006
|
|
|
|
|
Please write so somebody can understand you. I didn't understood a word you said.
--------------------------------------------------------
My development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
hey and sorry
just i need to know how i can catch error in asp.net
i hope that you understand me
and thanks anyway
DADAX
|
|
|
|
|
Using "try catch" block:
try {
}
catch( Exception ex ) {
}
|
|
|
|
|
but the code is write in the file.asp
coz i create datasource and formview and the command of add is writen in ASP
so if i write try catch in the code VB or C# it's didn't worked
i hope that you understand me
DADAX
|
|
|
|
|
Hi laks here,i want some help regarding stored procedures usage,how we can use stored procedure in ASP.net,plz explain me with example
|
|
|
|
|
Stored procedures have nothing to do with ASP.NET directly.
Stored procedures are stored on a databse server, and you can call them from .NET using ADO.NET
--------------------------------------------------------
My development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
hey i'll give you an example asp.net ( VB.net ) for executing a stored procedure in sql server 2005 but it same in another database
1) the stored procedures to add record and take the paramters from textboxes
the code for stored procedures in sql is :
create PROCEDURE SP1
(
@ID bigint ,
@Name nvarchar(50),
@Description nvarchar(500),
@ProjectID bigint
)
AS
INSERT INTO [TBASE].[dbo].[TaskType]
([ID]
,[Name]
,[Description]
,[ProjectID])
VALUES
(@ID ,@Name,@Description,@ProjectID)
RETURN
2) to execute this stored procedures from asp.net
Imports System
Imports System.Data
Imports System.Data.OleDb
Dim con As New OleDbConnection("Provider=SQLNCLI.1;Data Source=DADAX\DADAX;Integrated Security=SSPI;Initial Catalog=TBase")
con.Open()
Dim MyCommand As New OleDbCommand()
MyCommand.Connection = con
Dim proc As String
proc = "EXEC SP1 " & TextBox1.Text & ",'" & TextBox2.Text & "','" & TextBox3.Text & "'," & TextBox4.Text
MyCommand.CommandText = proc
MyCommand.ExecuteReader()
I wish that help you
DADAX
|
|
|
|
|
dadax_85 wrote: OleDbConnection
Why are you using OleDb to connect to a SQL Server. Why not use a SqlConnection?
dadax_85 wrote: proc = "EXEC SP1 " & TextBox1.Text & ",'" & TextBox2.Text & "','" & TextBox3.Text & "'," & TextBox4.Text
This is a security nightmare. You are advising people down the route to a SQL Injection Attack. Don't do this! See: SQL Injection Attacks and Tips on How To Prevent Them[^]
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
|
Dim con As New SqlConnection("Data Source=eyetech\sqlexpress;Initial Catalog=TBase;Integrated Security=True" providerName="System.Data.SqlClient" )
Dim MyCommand As New SqlCommand
con.Open()
MyCommand.Connection = con
Dim proc As String
proc = "EXEC SP1 " & TextBox1.Text & ",'" & TextBox2.Text & "','" & TextBox3.Text & "'," & TextBox4.Text
MyCommand.CommandText = proc
MyCommand.ExecuteReader()
DADAX
|
|
|
|
|
dadax_85 wrote: proc = "EXEC SP1 " & TextBox1.Text & ",'" & TextBox2.Text & "','" & TextBox3.Text & "'," & TextBox4.Text
very dangerous!
using these code instead:
[C#]
SqlCommand cmd = new SqlCommand("SP1", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@ID", TextBox1.Text);
cmd.Parameters.Add("@Name", TextBox2.Text);
cmd.Parameters.Add("@Decription", TextBox3.Text);
cmd.Parameters.Add("@ProjectID", TextBox4.Text);
cmd.ExecuteNonQuery();
-- modified at 21:55 Sunday 23rd April, 2006
|
|
|
|
|
hi all
i want to retrive an image from database in an imagebox, when the image appear it appear in another page so plz help me to retrive it in an image box .
thanks
-- modified at 3:59 Sunday 23rd April, 2006
|
|
|
|
|
To show an image in an IB, just set the "ImageSrc" property.
What do you mean by "appear in another page", and show some source code and can help
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
hi
that's the code to retrive the image from a Ms-sql databse
===================================================
Dim stream As MemoryStream = New MemoryStream()
Try
connection.Open()
cmd = New SqlCommand("select img_name from Product_image where imageID='16'", connection)
Dim image() As Byte = CType(cmd.ExecuteScalar(), Byte())
stream.Write(image, 0, image.Length)
Dim bitmap As Bitmap = New Bitmap(stream)
Response.ContentType = "image/gif"
Bitmap.Save(Response.OutputStream, ImageFormat.Gif)
Finally
connection.Close()
stream.Close()
End Try
============================================================
the problem that i can't retrive this image in an image box it retrives in another page and i want it to appear in the same page in an image box
thanks
|
|
|
|
|
OK - looks like what is happening is that you're just writing the bitmap to the response stream....so essentially, what you're seeing is that the browser is "redirected" to a page with just the image on?
In order to show the image in the image box, you'd need to do something like imageBox1.ImageSrc=Bitmap
Google can help further...
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
the problem that i use asp.net 2.0 and i didn't found anything image1.imgsrc, and that what i search for, so if you know a function like this tell me. i also search on google and code project but i didn't find anything untill now
thanks
|
|
|
|
|
Hi there,
You can place your sample code to read the image data from DB in a web page, say ShowImage.aspx, then in the web page containing the Image control, you can simply specify the ShowImage.aspx in the ImageUrl property of the Image control.
|
|
|
|
|
Hi there,
You can declare the dropdownlist in the the TemplateField of the DetailsView control, and simply use an additional datasource control to use with the dropdownlist. You can see an example[^] here to see how to customize the DetailsView control.
|
|
|
|