Showing posts with label text. Show all posts
Showing posts with label text. Show all posts

Thursday, March 29, 2012

EOF with SqlDataSource

I am trying to get record from a table and verify it with a textbox i have a sqldatasource.

i have a text box called txtEmail and this is my Select command. how can i get this working if its possible ?

something like txtEmail.text = SqlDataSource1.Secect then ... my code. (i dont know if this a correct way to do this)

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

SelectCommand="SELECTEmail FROM [t_CustomerAcct]"

thanks,

Hi,

I'm not quite clear what you want. Do you mean querying with some conditions for a return from the data table and verify if it's equal with the value from the text box or just want to make a query according the value from the text box?

If it's the first scenario, see the following sample:

 <asp:SqlDataSource ID="SqlDataSource1" runat="server" DataSourceMode="DataSet" ConnectionString="<%$ ConnectionStrings:TestConnectionString2%>" ></asp:SqlDataSource>  
SqlDataSource1.SelectCommand ="select CategoryName from Categories where CategoryID='1'";DataView dw = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);string str = dw.Table.Rows[0][0].ToString();if (str ==this.TextBox1.Text) {// equal}else {// not equal}

If it's the second scenario, just make select statement according the value from textbox directly.

this.SqlDataSource1.SelectCommand ="select CategoryName from Categories where CategoryID=@.id";this.SqlDataSource1.SelectParameters.Add("id",this.TextBox1.Text); DataView dw = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);string str = dw.Table.Rows[0][0].ToString();

Thanks.

Monday, March 26, 2012

Entity ’ in SQL Server 2000 output

I have an application that queries a SQL Server 2000 db through an ODBC driver on my Win2000 machine.

The DB contains some french text e.g. ltranger stored in a nvarchar column.

When I query the DB the result contains the entity &# 8217; rather than the character itself. I don't want this and it doesn't happen in SQL Server 7.

Tried changing the collation from SQL_Latin1_General_Cp1_CI_AS but with no luck.

Does anyone have experience with this?

ThanksHi,
Did you change collation on the entire dB or on table and column ?
Which collation do you have as standard ?

Regards
Tommy|||Hi,

We've changed the collation of the individual dB/table, but not
the collation of the server (which is still SQL_Latin1_General_CP1_CI_AS), so as not to affect other dBs.

Is it likely to be a collation issue?|||Hi,

I'm not sure about that. I've tried to insert that text into a table with collation SQL_Latin1_General_CP1_CI_AS and the result in query analyzer is correct, have you tried select "column" from "table".
Is the result the same ?
Where did the dB data come from ?
You may check how it's inserted into the dB.

Let me know !

Tommy|||Hi,

Thanks for taking an interest.

The original data is probably generated in some Microsoft applications i.e. Word. I have no control over that.

Yes, the results look okay in query analyser, the problem occurs when I do SQL calls through an ODBC driver from a remote machine.
I don't think it's a driver problem because I get the correct characters when testing on SQL Server 7.

What has changed between 7 and 2000?

Help|||Ok,
That's a tricky one..
One of the things that changed in SQL 2000 is collations (the possibility to set collations on dB, tables and columns not just on the server).
and sometimes just change the collation on the table or columns or only the dB just ain't enough.

Some things you can do is:
Check the application, how/what does it when querying the dB, how do the question look like. (run SQL profiler) if you can't look in the code.

The collation on SQL 7 ?

How did you do the switch from SQL 7 to 2000 ?

Regional settings on the client. (? ? I'm not sure about this)

Anyone else have a succession ?

I can send you a proc that handles collations if you'll like.
Regards
Tommy|||Hi,

Basically we just send an SQLExecute command with a SELECT statement.

Of course I can parse out the & #8217 from the results but surely I shouldn't need to? (And also what about any other entities I may encounter?)

Anyway, thanks for the suggestions

EnterpriseLibrary 2006 DATA ACCESS LAYER

in the class library i written the code name :customer is the lib name

using System;

using System.Collections.Generic;

using System.Text;

namespace Customer

{ class Entites

{

public int inTest;

public int inTest2;

}

}

Now in the Class1.cs i written the code

i am getting the data from the database by using enterprise lib 2006 connection function

now HOW TO BIND THE DATA TO LIST AND RETURN TYPE IS LIST

PLEASE CHECK THE CODE AND REDEFINE THE CODE

using System;

using System.Data ;

using System.Collections.Generic;

using System.Collections.Generic;

using System.Text;

using Microsoft.Practices.EnterpriseLibrary.Data;

using Microsoft.Practices.EnterpriseLibrary.ExceptionHandling;

using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;

using System.Collections;

using System.Xml.Serialization;

using System.Data.Common;

using Customer;

namespace Customer

{

class Class1

{

public List<Entites> getdata(int id)

{

Database db = DatabaseFactory.CreateDatabase("mycon");

System.Data.Common.DbCommand cmd ;

cmd = db.GetStoredProcCommand("GET_CUSTOMER");

cmd.CommandType = CommandType.StoredProcedure;

db.AddInParameter(cmd,"@.CID",System.Data.DbType.Int32,id);

List<Entites> objEntites = new List<Entites>();

using (IDataReader dr = db.ExecuteReader(cmd))

foreach (Entites obj in dr)

{

objEntites.inTest = obj.inTest;--ERROR LINE

// objEntites.Add(obj);

}

return objEntites;

}

}

}

Error 2 foreach statement cannot operate on variables of type 'System.Data.IDataReader' because 'System.Data.IDataReader' does not contain a public definition for 'GetEnumerator' D:\KOTI_PRJS\Enterprise\Customer\Class1.cs 34 13 Customer

Is this related to SSIS? If not, let me know and I'll be happy to move it to a more appropriate forum. If it is, please describe where the problem is occurring in SSIS.

Wednesday, February 15, 2012

Entering all the data in one big table

I am entering text heavy data in one big table, which has many columns. One
problem I'm having is the text does not fit in some rows (because the
characters are so many) and I have to truncate if the text is longer than
the length defined for the column.
Now I am hoping to change the design so that I don't need to truncate any
data. I know that creating a properly normalized database would solve the
problem, but this is very difficult for the situation I have. The change
should be as small as possible. What would be the best way to solve this
problem?You might want to use the TEXT datatype for some of the larger columns. You
can fit 2GB in each.
Andrew J. Kelly SQL MVP
"TomTom" <no_spam_please@.TomTom.com> wrote in message
news:uc2imULAEHA.3004@.TK2MSFTNGP10.phx.gbl...
> I am entering text heavy data in one big table, which has many columns.
One
> problem I'm having is the text does not fit in some rows (because the
> characters are so many) and I have to truncate if the text is longer than
> the length defined for the column.
> Now I am hoping to change the design so that I don't need to truncate any
> data. I know that creating a properly normalized database would solve the
> problem, but this is very difficult for the situation I have. The change
> should be as small as possible. What would be the best way to solve this
> problem?
>
>|||I'm working on international text. If I do it, then I cannot host Japanese
and Korean on the same machine. Is this correct?
"Andrew J. Kelly" <sqlmvpnoooospam@.shadhawk.com> wrote in message
news:uYvGhpMAEHA.3936@.TK2MSFTNGP11.phx.gbl...
> You might want to use the TEXT datatype for some of the larger columns.
You
> can fit 2GB in each.
> --
> Andrew J. Kelly SQL MVP
>
> "TomTom" <no_spam_please@.TomTom.com> wrote in message
> news:uc2imULAEHA.3004@.TK2MSFTNGP10.phx.gbl...
> One
than
any
the
>|||You can use nText datatype to store unicode data.
Andrew J. Kelly SQL MVP
"TomTom" <no_spam_please@.TomTom.com> wrote in message
news:OoeSKSYAEHA.132@.TK2MSFTNGP10.phx.gbl...
> I'm working on international text. If I do it, then I cannot host Japanese
> and Korean on the same machine. Is this correct?
>
> "Andrew J. Kelly" <sqlmvpnoooospam@.shadhawk.com> wrote in message
> news:uYvGhpMAEHA.3936@.TK2MSFTNGP11.phx.gbl...
> You
columns.
> than
> any
> the
change
this
>

Entering all the data in one big table

I am entering text heavy data in one big table, which has many columns. One
problem I'm having is the text does not fit in some rows (because the
characters are so many) and I have to truncate if the text is longer than
the length defined for the column.
Now I am hoping to change the design so that I don't need to truncate any
data. I know that creating a properly normalized database would solve the
problem, but this is very difficult for the situation I have. The change
should be as small as possible. What would be the best way to solve this
problem?You might want to use the TEXT datatype for some of the larger columns. You
can fit 2GB in each.
--
Andrew J. Kelly SQL MVP
"TomTom" <no_spam_please@.TomTom.com> wrote in message
news:uc2imULAEHA.3004@.TK2MSFTNGP10.phx.gbl...
> I am entering text heavy data in one big table, which has many columns.
One
> problem I'm having is the text does not fit in some rows (because the
> characters are so many) and I have to truncate if the text is longer than
> the length defined for the column.
> Now I am hoping to change the design so that I don't need to truncate any
> data. I know that creating a properly normalized database would solve the
> problem, but this is very difficult for the situation I have. The change
> should be as small as possible. What would be the best way to solve this
> problem?
>
>|||I'm working on international text. If I do it, then I cannot host Japanese
and Korean on the same machine. Is this correct?
"Andrew J. Kelly" <sqlmvpnoooospam@.shadhawk.com> wrote in message
news:uYvGhpMAEHA.3936@.TK2MSFTNGP11.phx.gbl...
> You might want to use the TEXT datatype for some of the larger columns.
You
> can fit 2GB in each.
> --
> Andrew J. Kelly SQL MVP
>
> "TomTom" <no_spam_please@.TomTom.com> wrote in message
> news:uc2imULAEHA.3004@.TK2MSFTNGP10.phx.gbl...
> > I am entering text heavy data in one big table, which has many columns.
> One
> > problem I'm having is the text does not fit in some rows (because the
> > characters are so many) and I have to truncate if the text is longer
than
> > the length defined for the column.
> >
> > Now I am hoping to change the design so that I don't need to truncate
any
> > data. I know that creating a properly normalized database would solve
the
> > problem, but this is very difficult for the situation I have. The change
> > should be as small as possible. What would be the best way to solve this
> > problem?
> >
> >
> >
>|||You can use nText datatype to store unicode data.
--
Andrew J. Kelly SQL MVP
"TomTom" <no_spam_please@.TomTom.com> wrote in message
news:OoeSKSYAEHA.132@.TK2MSFTNGP10.phx.gbl...
> I'm working on international text. If I do it, then I cannot host Japanese
> and Korean on the same machine. Is this correct?
>
> "Andrew J. Kelly" <sqlmvpnoooospam@.shadhawk.com> wrote in message
> news:uYvGhpMAEHA.3936@.TK2MSFTNGP11.phx.gbl...
> > You might want to use the TEXT datatype for some of the larger columns.
> You
> > can fit 2GB in each.
> >
> > --
> > Andrew J. Kelly SQL MVP
> >
> >
> > "TomTom" <no_spam_please@.TomTom.com> wrote in message
> > news:uc2imULAEHA.3004@.TK2MSFTNGP10.phx.gbl...
> > > I am entering text heavy data in one big table, which has many
columns.
> > One
> > > problem I'm having is the text does not fit in some rows (because the
> > > characters are so many) and I have to truncate if the text is longer
> than
> > > the length defined for the column.
> > >
> > > Now I am hoping to change the design so that I don't need to truncate
> any
> > > data. I know that creating a properly normalized database would solve
> the
> > > problem, but this is very difficult for the situation I have. The
change
> > > should be as small as possible. What would be the best way to solve
this
> > > problem?
> > >
> > >
> > >
> >
> >
>