|
Here I have a problem that .i am using calender in my webform,when i pick a date from calender into a textbox and again i need to insery that Textbox value into Database Date/time datatype column.
my code is as below
cmdins = "Insert into Employee(empid,dateofbirth)values('" & txteid &"','" & txteid &"')"
Here the error is ,the conversion of char datatype to small date/type resulted outofrange value.
So how to convert this textbox value(ie date)to insert into database table.give me a solution.
|
|
|
|
|
Both textboxes have the same id?
Apply # to the adjacent of textbox values for date for conversion(if u have date datatype in the database.)
|
|
|
|
|
Dim dob1 As Date
dob1 = Date.Parse(Txtdob1.Text)
cmdins=insert into employee(empid,dateofbirth)values(1,#" & dob1 & "#)"
Here in my database its datatype is smalldatetime and
i am trying to isnert as above with the date 05/09/2006,it is giving error as ,
'#5' is not permitted in this context. Only constants, expressions, or variables allowed here. Column names are not permitted.
How to give correctly,
Give me an idea
|
|
|
|
|
If u r using sql server then just use single codes don't use # otherwise in case of access it is right.
Now the qusetion is which database u r sging
|
|
|
|
|
Here i am using Sqlserver and my database datatype is 'smalldatatime' and i am taking date from calender into textbox.
Now i tried with all types of inputs means,
'" & txtdob1.text & "',and" & txtdob1.text & " and #" & txtdob1.text & "#.Why all these are giving error,How to convert this text value into datetime datatype and how to insert into database table.
Give me correct idea,I have no idea.
Whether the following format is correct or not???
#" & Format(Txtdob1.Text, "dd/mm/yyyy") & "#
give me correct solution.
-- modified at 4:47 Saturday 23rd September, 2006
|
|
|
|
|
The problem is that the database is not using the date format that you are using, so it interprets the date differently.
Use DateTime.Parse or DateTime.ParseExact to parse the string to a DateTime value, then use a parameterised query to send the value to the database.
---
b { font-weight: normal; }
|
|
|
|
|
Dim dob1 As DateTime
dob1 = DateTime.Parse(Txtdob1.Text)
cmdins = "insert into employee(empid,dateofbirth)values(1," & dob1 & ")"
how to insert into database table?
The above code i have given.why it is still giving an error,wat must i have to use.
give me a solution plese.
Thanks
-- modified at 5:32 Saturday 23rd September, 2006
|
|
|
|
|
Because you are still adding the date to the query in the wrong format. If you for an example enter todays date, and that is added to the query in the format 23/9/2006, that will be interpreted by the database as a numeric expression that calculates as roughly 0.001274.
If you don't want to use parameterised queries, you have to specify a format for the date that the database can understand.
Also, when you seek assistance with a problem, it's very often very helpful if you are a bit more specific than "an error".
---
b { font-weight: normal; }
|
|
|
|
|
hi can I use the code for show the image in data grid or data list? i have 30 products that 28 of them have image but 2 of them dosen't have, when I try to show the image in datalist for 2 product that dont have image datalist show imagebutton whithout any image with red 'x' I want to do something that if the product dont have image the datalist dosent show image button. Please Sggest in VB.net!
Vivek Khare
|
|
|
|
|
If u don't have image for the particular record.Then do the followiunf thing.
U have a function named Visible for the image control.Write a return type function for that Visible function
in the html view.
now in the code behind file
include the imports system.io
publilc function FindVisibility(byval filepath as string)
if(path.exist(filepath))
return true
else
return false
End sub
Hope this may help u.
|
|
|
|
|
Thanx a lot amaneet.
It is done!
Vivek Khare
|
|
|
|
|
i would really love to use SOAP extensions, but i cannot seem to configure them so that ProcessMessage ever gets called. If anyone would be willing to help i can send a zip file of the smallest example i can construct from the MSDN documentation. The sample compiles. The service page loads. The webmethod gets called, but neither ProcessMessage nor any of the other SOAP extension code gets called.
|
|
|
|
|
Sir,
I am trying to write a web app that allows the user to capture audio from the client machines microphone. Can u help me how to captures the audio.
Thanks
|
|
|
|
|
I'm using C# and ASP.Net in all of this.
So I'm basically not internalizing the concept, there's missing steps in the samples or I'm just thick.
Here's what I think I want to do:
1. I have a page MediaGallery.aspx in it I have 20 Image controls.
2. I want to pull images from SQLServer using a streaming ImageStream.aspx page that writes out the image as a byte[] stream.
3. The Page_Load event of the ImageStream.aspx will use a query string to parse the ImageID and pull the image from the sqldb and stream it out.
4. ImageX (where x > 0 < 21) will have it's .ImageURL = "ImageStream.aspx?ImageID=x".
My questions go like this. How exactly (please show me with some code if you don't mind) do I do this iteratively so that I can fill all 20 Image controls with the correct image and not have 20 instances of ImageStream.aspx? How do I close that page? Do I need to? How do I do this gracefully? I'm guessing since the Page_Load event of ImageStream.aspx outputs a binary stream that ImageStream.aspx never gets created as a page it just becomes a binary stream and that's that. If so how do I dispose of that stream or do I let the CLR manage that?
If someone could provide a snippet that shows how to link that up that would be really cool.
- Rex
|
|
|
|
|
I would have said create your own HttpHandler to avoid the overhead of creating a Page instance, but then I found this article[^].
|
|
|
|
|
Hi. how can i create nested datalists? i test some codes but they didn't work.
thanks..
|
|
|
|
|
1. You will need to include you child data lists as a control in your list's item template.
2. Then handle the OnItemDataBound event
3. In the ItemDataBound event use the FindControl method to get the child data list.
4. Bind the child data list to the appropriate data source (i'm assuming some table filtered using a data relation or some similar method of filtering data)
|
|
|
|
|
This is pretty simple...
i have an aspx page with 2 controls - a button and a dropdownlist.
i want the user to choose something from the list and press the button in order to execute the chosen operation and retrive the HTML result.
it is working fine, but what i want to do, is sending to the client the new page (the result of the operation he chose) but to still keep these controls where they are (i want the results to be displayed beneath these controls.
what is the best way to do that?
Thanks.
|
|
|
|
|
You can use any number of controls to do this. I suggest using a div tag like
<div id="content" runat="server>
</div>
and then content.innerHTML = YourHTMLString;
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
I would recommend using <asp:Panel> which renders as a div but has more strongly typed methods. Also, while it contains no data I would set it to not be visible.
i.e. under your current HTML
<asp:Panel runat="server" ID="pnlData" Visible="false" />
Then when you get the data back use:
pnlData.innerHTML = YourHTMLString;
pnlData.Visible = true;
in your code behind.
|
|
|
|
|
I am extremely new to the ASP.NET arena and I am trying to write a web app that allows the user to capture audio from the client machines microphone. I wrote the code that captures the audio and now I am trying to incorporate it into my ASP.NET app. The issue I am having is trying to find a way to run the server code (to capture audio) on the local machine without being too invasive or without fully downloading an .exe on the client machine. Is this possible?
Lawrence.
|
|
|
|
|
Lawrence,
You would have to get an executable on to the client machine to do this, or use an existing one (such as Flash, which has microphone support). Any commercial plug-in will be designed prompt the user before allowing you to listen in.
Best,
DTrent
|
|
|
|
|
DTrent, thanks for the response. I will give it a shot.
|
|
|
|
|
Hey all
I have a gridview on my page which the you can filter. This all works fine, however when your filter returns no results the whole table disappears. Is there anyway to keep the header row visible instead of the blank screen?
Thanks in advance
|
|
|
|
|
This is how I've done it in the past:
Always include one blank or dummy row at the very beginning of the gridview's datasource datatable. Then in the gridview's RowDataBound event add code to check if it is the first row, and if it is to hide it. It would look something like this:
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
Select Case e.Row.RowType
Case DataControlRowType.DataRow
If e.Row.RowIndex = 0 Then e.Row.Visible = False
End Select
End Sub
Since the gridview has a row it will display the headers, but the row itself will be hidden.
|
|
|
|