SQL Datatype change and Data entry field in ASP.net website

Hi Guys,

Have private messaged a guru on here for some advice but dont know if hes the right man to ask on this.

I am having a problem with a data length restriction on an asp:textbox field.

The field writes to the MS SQL database which had a datatype of VarChar(50) I used the Alter table query to change this to VarChar(2000) and this has been done and all looks to be ok.

I go back into my website enter more text in the field and I get 50 characters of what I put in.

I have gone into my .vb files for products and the aspx.vb file and changed the limits in those files to VarChar(2000) as well but still I only get 50 characters.

Where am I going wrong and where should I be looking in order to fix this?

Thanks for any help guys really appreciate it.

Chris

Is it possible to use SQL Server Management Studio to change the datatype? That way you can bypass using SQL altogether. Hard to tell without your Alter Table code.

Are you using LINQ to SQL?

Mssql

Having spoke to a few peoPl I think Its an asp problem

I think you misunderstood my question. Nevermind.

Appologies,

I’m using mssql. Used right alter table query got success message. Check column properties and it’s been updated to varchar 2000.

But still problem persists

Can you show us your data-access code? It’s apparent that it isn’t your database.

Agreed. That’s why I asked about LINQ to SQL. The L2S tables would probably also have to be regenerated.

Did you recompile and redeploy your app? That could make the difference if there were changes that wouldn’t automatically be picked up.

You should also be using VARCHAR(MAX) here, really no reason not to for any string field in 2011.

Would TEXT (or NTEXT) be a reasonable choice as well?

Not unless you had to be on SQL 2000 for some reason or another. And I’m hard pressed to think of a decent reason.

Ah, I didn’t know it was deprecated. I thought TEXT allowed more storage than VARCHAR but I was wrong.

Hi Guys,

Sorry to be a total noob at this but your gonna have to give me some real dummed down advice on this I literally have just had to pick up this project with no experience in either SQL or ASP development until 9months ago I didnt even know what visual studio was let alone what you did with it!

Can you show us your data-access code? It’s apparent that it isn’t your database.

How do I do this?

Agreed. That’s why I asked about LINQ to SQL. The L2S tables would probably also have to be regenerated.
I think this is where the problem is I dont necessarily think its the website itself as having read a few things online my website isnt a precompiled website its just always been a case of copying the files onto the IIS server and it works.
When trying to edit the fields in the column using SQL Management studio I still cannot add more than 50 characters to the field and I get an error message about it being truncated and that the error location is with;

ERROR SOURCE: .net sqlclient data provider

Did you recompile and redeploy your app? That could make the difference if there were changes that wouldn’t automatically be picked up.

I have looked at re-deploying the website but I stopped trying to do anything with it until I spoke to someone on here about it as I believe its not compiled anyway and this has made me think its not the website that is the issue its still the database.

I spoke to Rudy on here who said he couldnt help its just asif the table hasnt updated but then I may not have give him all the information that he needed.

Thanks for the help guys I really do appreciate it

I think you’d have to be of more help for us to understand where the issue is. May I suggest hiring in someone with experience?