Showing posts with label record. Show all posts
Showing posts with label record. Show all posts

Wednesday, March 28, 2012

Text field is empty

I'm trying to insert a record on an sql server database table that has
among others a text type field. The insert happens without errors and
all the fields show the correct information except for the text field
when the number of characters is larger than 900. In this case the text
field appears empty. If the text is less or equal to 900 characters
they are inserted with no problem.

In this case have a stored procedure with several input variables
including the text one and a asp.net page with a command that is filled
with the several parameters necessary to run the procedure. One of them
is the text parameter that is defined as follows:

insertcommand.Parameters.Add(New SqlParameter("@dotnet.itags.org.texto", SqlDbType.Text,
2147483647))
insertcommand.Parameters("@dotnet.itags.org.texto").Value = texto.Text
Does someone knows what is causing this problem ?

ThanksHi,

Why do you think it's empty?
Normally, when you use SQL Server Enterprise Manager to
open a table with text field, it shows actual content when
it's <= 900 characters, but <Long Text> when it's > 900
characters. Actual content is in table. If you use Select
query in Query Analyzer, you can see the difference.

Hope it's helpful
Elton Wang
elton_wang@.hotmail.com

>--Original Message--
>I'm trying to insert a record on an sql server database
table that has
>among others a text type field. The insert happens
without errors and
>all the fields show the correct information except for
the text field
>when the number of characters is larger than 900. In this
case the text
>field appears empty. If the text is less or equal to 900
characters
>they are inserted with no problem.
>In this case have a stored procedure with several input
variables
>including the text one and a asp.net page with a command
that is filled
>with the several parameters necessary to run the
procedure. One of them
>is the text parameter that is defined as follows:
>insertcommand.Parameters.Add(New SqlParameter("@.texto",
SqlDbType.Text,
>2147483647))
>insertcommand.Parameters("@.texto").Value = texto.Text
>Does someone knows what is causing this problem ?
>Thanks
>.
Yo're right, Elton. I didn't knew about the EM limitation. Once I used
the QA the information appeared. Thanks!

Text field is empty

I'm trying to insert a record on an sql server database table that has
among others a text type field. The insert happens without errors and
all the fields show the correct information except for the text field
when the number of characters is larger than 900. In this case the text
field appears empty. If the text is less or equal to 900 characters
they are inserted with no problem.
In this case have a stored procedure with several input variables
including the text one and a asp.net page with a command that is filled
with the several parameters necessary to run the procedure. One of them
is the text parameter that is defined as follows:
insertcommand.Parameters.Add(New SqlParameter("@dotnet.itags.org.texto", SqlDbType.Text,
2147483647))
insertcommand.Parameters("@dotnet.itags.org.texto").Value = texto.Text
Does someone knows what is causing this problem ?
ThanksYo're right, Elton. I didn't knew about the EM limitation. Once I used
the QA the information appeared. Thanks!

Tuesday, March 13, 2012

Textbox - enter value and display record in FormView

Hi:

I would like to have user enter a value in the text box and have a record shown in the FormView. I know how to do it with the dropdown list showing the values but the list would be too long to display. I onder to find a record I would need to have user type it in. The field to seach on is a unique (key) field.

CAn you suggest a method?

Thanks.

It is exactly the same, except that you will need a submit button

<asp:TextBox id="txt1" runat="server" />
<asp:Button OnClick="submit" Text="Submit" runat="server" />

and on postback

Sub submit(sender As Object, e As EventArgs)
re-bind using this query "SELECT * FROM SomeTable Where ID = " & txt1.Text
End Sub

Is this what u mean?


I think he just want to know the TextChange event on TextBox.you can use this to show you record in FormView.but this textchange event i think prefer for Asp.net Ajax enabled website.i also think there is one event name like textbox lose focus,you can found this.

Wink


you mean onBlur (maybe OnServerChange?)

Anyway... I'm pissed of cause I had 199 points and now I have only 195 miserable points... somethign stinks in here!!!

kidding,
Mauro


Hi:

Thanks for your advise. I tried few things as follows:

1) I created a textbox txt1 and a button

2) I placed controls in the Ajax update panel

3) I added formview based on the query and added a parameter as follow: (permit# is my search field and my key)

<asp:SqlDataSourceID="SqlDataSource1"runat="server"ConnectionString="<%$ ConnectionStrings:DatabaseConnectionString %>"

SelectCommand="SELECT [PermitNo], [TaskId], [ProjectManagerId], [OnSiteFirstName] FROM [Permits] where PermitNo = @.PermitNo">

<SelectParameters>

<asp:ControlParameterControlID="txt1"Name="PermitNo"PropertyName="Text"/>

</SelectParameters>

</asp:SqlDataSource>

So, when I type Permit number in my box it runs a query and show my record in formview.

This works perfectly. But I need to write something so it will test for "not found" so I could display message "Record not found". Do you have any ideas how I can do it? I use C# but possibly I can do it with ASP??

I would appreciate your assistance.


Hi:

Thanks for your advise. I tried few things as follows:

1) I created a textbox txt1 and a button

2) I placed controls in the Ajax update panel

3) I added formview based on the query and added a parameter as follow: (permit# is my search field and my key)

<asp:SqlDataSourceID="SqlDataSource1"runat="server"ConnectionString="<%$ ConnectionStrings:DatabaseConnectionString %>"

SelectCommand="SELECT [PermitNo], [TaskId], [ProjectManagerId], [OnSiteFirstName] FROM [Permits] where PermitNo = @.PermitNo">

<SelectParameters>

<asp:ControlParameterControlID="txt1"Name="PermitNo"PropertyName="Text"/>

</SelectParameters>

</asp:SqlDataSource>

So, when I type Permit number in my box it runs a query and show my record in formview.

This works perfectly. But I need to write something so it will test for "not found" so I could display message "Record not found". Do you have any ideas how I can do it? I use C# but possibly I can do it with ASP??

I would appreciate your assistance.


FormView lets u define a template for "no data"

<emptydatatemplate>
No records available.
</emptydatatemplate>


More info at:http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.formview.emptydatatemplate(VS.80).aspx

Regards,
Mauro


Yes, thank so much for your help. I got this working!!!!


It is Friday afternoon - I will check it on Monday - but I am sure it will work! Thanks for all your assistance .