Showing posts with label web. Show all posts
Showing posts with label web. Show all posts

Tuesday, March 27, 2012

binding textbox text to a database field

hello

is it possible to to bind a single field from a database table to a textbox.

I am trying to open a web form with five textboxes on it. When it loads is it possible to have the textboxes filled with a different field from a row in a database, selected with a sql statment.

Thanks in advance NubNub

Wrong Forum.|||

Yes, that is quite possible.

But you will get better assistance if you post your question in one of the .NET ASP related forums.

sql

Binding a SqlDataSource to a TextBox or label

I have a SQL database with 1 column in it.. it is a do not call registry for my office. I want to make a web application so our leads can go on the web and request to be put on the do not call list. problem is, if their number already exists, it gets a violation of primary key...

Normal handling for this would be to do a select query based on user input, and if it exists in the database, tell them that, else do the insert query...

Problem is, i cant seem to figure out how to bind the result of the select query to a textbox or label so i can compare the results to do that logic. Any ideas? This is in asp .net 2.0. Thanks!

-Dan

You can't directly bind to a Label or a TextBox, but you certainly can set the result of your DataSource to the Text property of your control. Here's an example:

ASPX

ProductName = <asp:label id="lblProductName" runat="server" /><asp:objectdatasource id="odsProducts" runat="server" selectmethod="GetProductByProductID"typename="NorthwindTableAdapters.ProductsTableAdapter"><selectparameters><asp:parameter defaultvalue="1" name="ProductID" type="Int32" /></selectparameters></asp:objectdatasource>

CODE-BEHIND

protected void Page_Load(object sender, EventArgs e){if (!this.IsPostBack){DataView dv = (DataView)odsProducts.Select();lblProductName.Text = dv[0]["ProductName"].ToString();}}

|||

Acctually... i figured out a way... check this out..

Dim dv As Data.DataView = SqlDataSource1.Select(DataSourceSelectArguments.Empty)

TextBox1.Text = dv.ToTable.Rows(0)("PHONE")

This works, but now i have another problem. If there is no row 0 (meaning if the number doesnt exist) the page fails. How can i check to see if the record doesnt exist, then do something else?

|||Just check to see if the DataView.Count property is greater than 0.|||Thanks, that worked great!

Bind SQL reporting services (Reports) to ASP.NET (Urgent)

Hi all,

Currently I have a project that require me to use reporting services (Reports) together with ASP.net web application.

However, I have the following problem.

I have an asp.net web application. From there, I have a textbox whereby user can type a specific date. The specific date should then be incorporate with the sql reporting services. The report that is being generated will contain data that is on the specific date.

How can I do that?

I try to search through the internet but to no result. Can anyone help out?

Thank you so much.Read a book on Reporting Services ... you can pass everything to Reporting Services through the webservices it exposes ...
Microsoft has some good books about Reporting Services ... Search for William Vaugh ... He's very good

Thursday, March 22, 2012

Binary column

We have a binary column that stores web passwords.
What is the proper way to access this column?
The sql below is blowing up!
UPDATE AppServices.dbo.DBUsers
SET Password = 'MyPassword'
WHERE UserId ='MyLogin'Here is one way to accomplish this task.
UPDATE AppServices.dbo.DBUsers
SET Password = pwdencrypt('MyPassword')
WHERE UserId ='MyLogin'
pwdencrypt and pwdcompare are two undocumented SQL functions.
"Arne" <Arne@.discussions.microsoft.com> wrote in message
news:E269D86B-E84E-45CE-8E33-81D483391080@.microsoft.com...
> We have a binary column that stores web passwords.
> What is the proper way to access this column?
> The sql below is blowing up!
> UPDATE AppServices.dbo.DBUsers
> SET Password = 'MyPassword'
> WHERE UserId ='MyLogin'

Monday, March 19, 2012

Big Log file that won't shrink....

I have a fairly simple DB, One Log file, one data file, its got half a dozen tables in it that are used for a web based app that allows users to look each other up (think online telephone directory with a few extra bits and you are there), there's a data feed that adds new lines each day as users data changes or new people get added. But this is a couple of hundred or so lines a day, the tables hold about 40,000 data lines as we never delete data just retire it.

The problem is the main data file is about 200Mb, the Log file however is 3.8Gb. Now we did import and re-import various bits initially and clear down tables and such. But I don't understand why i can't shrink the log file. I've tried everything I can think of. I've even detached and re-attached the DB. Still no joy.

The file size/usage is

data file 200Mb size in use 117Mb

log file 3749.99Mb size in use 3719.89Mb

Anyone have any suggestions for things to look at?

many thanks

Steve

Hi,

look here:

http://www.aspfaq.com/show.asp?id=2471

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

Sunday, March 11, 2012

BI Web Intelligence

I am currently looking for a reporting solution for my company. I am tore
between RS and Crystal. We are primarily a MS shop with enterprise
licensing.
Business Objects (BO) has presented me with a really nice set of tools aside
from their reporting solution. Aside from reporting I would like to get
more involved with BI (dataming and cube analysis). At some point I would
like to have the end users browse the cube/universe data for quick adhoc
analysis.
BO presented me with really nice web intelligence software which is all
integrated with the BO product line. The products were: BO Web
Intelligence, BO Predictive Analysis, BO Set Analysis. These products seem
easy to use and the data can all be analyzed through the web once the
developer creates the middle layer.
I know MS has SSAS which contains the cube technology and data mining.
Do they offer a packaged product ready for enduser use similiar to BO?
Do you need to program your needs in the BI environment to develop what your
looking for?
Is there a way to get the SSAS cubes designed for end users to access
through the web/intranet?
Thanks.Basically you need to see what exactly you require. Both offer same things
but MS is cost effective solution and one stop solution. You also get
everything packged and moreover the SSRS comes free with Enterprise version
of SQL SERVER. So if you are planning for a small / mid size then this will
be ideal for you.
Amarnath
"Brian Shannon" wrote:
> I am currently looking for a reporting solution for my company. I am tore
> between RS and Crystal. We are primarily a MS shop with enterprise
> licensing.
> Business Objects (BO) has presented me with a really nice set of tools aside
> from their reporting solution. Aside from reporting I would like to get
> more involved with BI (dataming and cube analysis). At some point I would
> like to have the end users browse the cube/universe data for quick adhoc
> analysis.
> BO presented me with really nice web intelligence software which is all
> integrated with the BO product line. The products were: BO Web
> Intelligence, BO Predictive Analysis, BO Set Analysis. These products seem
> easy to use and the data can all be analyzed through the web once the
> developer creates the middle layer.
> I know MS has SSAS which contains the cube technology and data mining.
> Do they offer a packaged product ready for enduser use similiar to BO?
> Do you need to program your needs in the BI environment to develop what your
> looking for?
> Is there a way to get the SSAS cubes designed for end users to access
> through the web/intranet?
> Thanks.
>
>|||"Brian Shannon" <brian.shannon@.diamondjo.com> wrote in message
news:O2$FcrnDHHA.1220@.TK2MSFTNGP04.phx.gbl...
> BO presented me with really nice web intelligence software which is all
> integrated with the BO product line. The products were: BO Web
> Intelligence, BO Predictive Analysis, BO Set Analysis. These products
> seem easy to use and the data can all be analyzed through the web once the
> developer creates the middle layer.
> I know MS has SSAS which contains the cube technology and data mining.
> Do they offer a packaged product ready for enduser use similiar to BO?
> Do you need to program your needs in the BI environment to develop what
> your looking for?
Take a look at Microsoft Performance Point 2007, as it will help you do much
of what you're looking for.
http://office.microsoft.com/en-us/performancepoint/FX101680481033.aspx
Hope this helps.
Ted|||Hey, Brian
One of Microsoft's biggest ambitions is to be leading the Business
Intelligence (BI) arena. In 2007, they have announced the release of
several new products and integration with the Office suite (especially
Excel). I would really consider the Microsoft suite of BI offerings
that will be coming up in the next year. Like Ted said,
PerformancePoint will be a key product to get into BIPM, and will allow
users to view scorecard technology, data mining, cube analysis, etc.
They will be leveraging a lot of their BI offerings with Office and
SharePoint, in order to provide the end users access to data w/ tools
like Excel and their web browser (IE) which they're already familiar
with and comfortable using.
Since your company is a MS shop, and they already run SQL Server, the
license for Reporting Services is included, so you can have a pretty
good reporting engine up and running fairly quickly. Reporting
Services can connect to several data sources including OLTP and OLAP,
such as SQL Server DB, Analysis Services cubes, Oracle, XML web
services (RS 2005), and in the SP2 of SQL 2005, they will be adding
support for Hyperion. If you already have cubes setup in an Analysis
Services database, you can simply write the MDX (or use the MDX query
generator in RS 2005) for the report query, then design your report
layout, and the learning curve for Reporting Services is fairly
minimal.
I have seen a lot of companies that used Crystal reports as their main
reporting tool, move away from that and migrate all their reports to
Reporting Services because the licensing is much more cost effective --
it's included w/ their SQL Server license!
I would definitely recommend spending some time in the MS BI web site
to learn about their future offerings in that area.
(http://www.microsoft.com/bi)
Regards,
Thiago Silva, MCAD.NET
On Nov 22, 10:09 pm, "Ted Malone" <ted.nospam.mal...@.gmail.com> wrote:
> "Brian Shannon" <brian.shan...@.diamondjo.com> wrote in messagenews:O2$FcrnDHHA.1220@.TK2MSFTNGP04.phx.gbl...
> > BO presented me with really nice web intelligence software which is all
> > integrated with the BO product line. The products were: BO Web
> > Intelligence, BO Predictive Analysis, BO Set Analysis. These products
> > seem easy to use and the data can all be analyzed through the web once the
> > developer creates the middle layer.
> > I know MS has SSAS which contains the cube technology and data mining.
> > Do they offer a packaged product ready for enduser use similiar to BO?
> > Do you need to program your needs in the BI environment to develop what
> > your looking for?Take a look at Microsoft Performance Point 2007, as it will help you do much
> of what you're looking for.
> http://office.microsoft.com/en-us/performancepoint/FX101680481033.aspx
> Hope this helps.
> Ted

Sunday, February 19, 2012

Best way to send email from a C# stored procedure?

I thought I could just copy over some asp.net code like:

System.Web.Mail.MailMessage mailMessage =new System.Web.Mail.MailMessage();

But VS2005 doesn't seem to want me touching System.Web.Mail.

Any ideas?

Thanks,

Allen

OK, I figured out that I need to useSystem.Net.Mail, but here is the next problem- when I create an instance of the SmtpClient object like this:

SmtpClient

client =newSmtpClient("localhost",25);I get this exception:
System.Security.SecurityException: Requestfor the permissionof type'System.Net.Mail.SmtpPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.System.Security.SecurityException: at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) at System.Security.CodeAccessPermission.Demand() at System.Net.Mail.SmtpClient.Initialize() at System.Net.Mail.SmtpClient..ctor(String host, Int32 port)
|||

has anyone managed to solve this one?

am getting the same error...

|||

I was able to get around that error (and a few others) by doing the following:

ALTER DATABASE [PUBS]SET TRUSTWORTHYONGOALTER ASSEMBLY [TaskScheduler]WITH PERMISSION_SET = UNSAFE

I hope this helps.

-Allen Cryer

|||

I was able to get around that error (and a few others) by doing the following:

ALTER DATABASE [PUBS]SET TRUSTWORTHYONGOALTER ASSEMBLY [TaskScheduler]WITH PERMISSION_SET = UNSAFE

I hope this helps.

-Allen Cryer

|||mate,you're a champ.I've looked for the last 24 hours all over.Thank you very much. Works like a charm now.

Thursday, February 16, 2012

Best way to move CSK database from one computer to another

Hi,

Can someone suggest a good way to move the CSK database from ine instandc of MSDE200 to another on a different PC. I tried exporting using MS Web database administrator which moved the tables but stripped off the defaults and all stored proceedures.

Any better ideas?

Halsorry for my sloppy post...
that should read "one instance of MSDE2000 to another..."

Best way to learn SQL Mobile?

I am an experienced web developer using PHP and MySql have experience with VB.

What is the best way for me to learn programming pocket pc's? Is using sql server mobile the best offline database to use as I will be using MySql Compact framework to connect direcly to our Linux server.

Any help is much appreciated as I can't seem to find any useful tutorials on quering an sql databse to update, insert, read or delete. I have created a datebase however, I just don't know how to use it.

Thanks in advance.

Mark

Hi Mark,

The SQL Mobile is ideal for offline scenarios. You can find SQL Mobile related resource on MDSN. I am providing the links below

SQL Mobile page on MSDN - http://msdn.microsoft.com/mobility/sqlmobile/default.aspx

SQL Mobile page from SQL Server home: http://www.microsoft.com/sql/editions/sqlmobile/default.mspx

SQL Mobile Books Online - http://msdn2.microsoft.com/en-us/library/ms173053.aspx

For advanced topics like replication with Microsoft SQL Server backend databases you can visit the following links

Connectivity with Microsoft SQL Server - http://www.microsoft.com/sql/editions/sqlmobile/connectivity-tools.mspx

HOL - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnppcgen/html/med302_msdn_sql_mobile.asp

Manish

|||I'm working on somthing simular too. I want to connect to a mysql server on the web.
What do you use to connect to the mysql server?

The only thing I found for CF is MySQLDirect...

could you please let me know.
Dennis|||

I think I use the same one, it is made by Core Lab. The download link is below.

http://crlab.com/mysqlnet/download.html

Thanks for the links but I still cannot find a tutorial that demonstrates some simple insert, delete, update and select queries.

Mark

|||

Hi Mark,

Below is a specific link to IBuySpy Sample app available on MSDN

http://msdn2.microsoft.com/en-us/library/ms174006.aspx

IBuySpy Delivery 2005 Sample Application (SQL Server Mobile) - "When you install IBuySpy Delivery, you install modified versions of the IBuySpy database and Web application, and the code specific to the IBuySpy Delivery 2005 smart device application."

Hope this helps

Regards

Manish

|||

Thanks for all this help Manish, but I think your going to hate me now. I am starting to think that I am either stupid, a complete novice or more likley both.

The sample app you gave me is overly complicated and requires MS Server 2005 to be installed on my computer. I have no intension of doing this as I don't need it. I just need a sample of an extreamely simple application that has its own database and doesn't sync with anything, it is stand alone.

I simply need to know how to select data from the database and store it in an array(?) or something similar, and to send sql command to the database. I ask to store the results of a quey in an array because every example app I have found shows the data as a datagrid, which is ugly and not suitable for my current project.

ie. With PHP I would explain the above like so.

1. Connect to database using a connect string.

2. get results of a query using something like : $queryResults = getQueryResults("SELECT * FROM table")

3. Use a loop to read the $queryResults array. Read the date using : $queryResults[0]['name'] <-- this would give you the stored value in the first row and the in the field 'name'.

Can development for the pocket pc be this easy? I have developed app's for the Palm OS and naver had as much trouble as this. Why is it so overly complicated?

Thanks for your patience and help.

Mark

Best way to learn SQL Mobile?

I am an experienced web developer using PHP and MySql have experience with VB.

What is the best way for me to learn programming pocket pc's? Is using sql server mobile the best offline database to use as I will be using MySql Compact framework to connect direcly to our Linux server.

Any help is much appreciated as I can't seem to find any useful tutorials on quering an sql databse to update, insert, read or delete. I have created a datebase however, I just don't know how to use it.

Thanks in advance.

Mark

Hi Mark,

The SQL Mobile is ideal for offline scenarios. You can find SQL Mobile related resource on MDSN. I am providing the links below

SQL Mobile page on MSDN - http://msdn.microsoft.com/mobility/sqlmobile/default.aspx

SQL Mobile page from SQL Server home: http://www.microsoft.com/sql/editions/sqlmobile/default.mspx

SQL Mobile Books Online - http://msdn2.microsoft.com/en-us/library/ms173053.aspx

For advanced topics like replication with Microsoft SQL Server backend databases you can visit the following links

Connectivity with Microsoft SQL Server - http://www.microsoft.com/sql/editions/sqlmobile/connectivity-tools.mspx

HOL - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnppcgen/html/med302_msdn_sql_mobile.asp

Manish

|||I'm working on somthing simular too. I want to connect to a mysql server on the web.
What do you use to connect to the mysql server?

The only thing I found for CF is MySQLDirect...

could you please let me know.
Dennis|||

I think I use the same one, it is made by Core Lab. The download link is below.

http://crlab.com/mysqlnet/download.html

Thanks for the links but I still cannot find a tutorial that demonstrates some simple insert, delete, update and select queries.

Mark

|||

Hi Mark,

Below is a specific link to IBuySpy Sample app available on MSDN

http://msdn2.microsoft.com/en-us/library/ms174006.aspx

IBuySpy Delivery 2005 Sample Application (SQL Server Mobile) - "When you install IBuySpy Delivery, you install modified versions of the IBuySpy database and Web application, and the code specific to the IBuySpy Delivery 2005 smart device application."

Hope this helps

Regards

Manish

|||

Thanks for all this help Manish, but I think your going to hate me now. I am starting to think that I am either stupid, a complete novice or more likley both.

The sample app you gave me is overly complicated and requires MS Server 2005 to be installed on my computer. I have no intension of doing this as I don't need it. I just need a sample of an extreamely simple application that has its own database and doesn't sync with anything, it is stand alone.

I simply need to know how to select data from the database and store it in an array(?) or something similar, and to send sql command to the database. I ask to store the results of a quey in an array because every example app I have found shows the data as a datagrid, which is ugly and not suitable for my current project.

ie. With PHP I would explain the above like so.

1. Connect to database using a connect string.

2. get results of a query using something like : $queryResults = getQueryResults("SELECT * FROM table")

3. Use a loop to read the $queryResults array. Read the date using : $queryResults[0]['name'] <-- this would give you the stored value in the first row and the in the field 'name'.

Can development for the pocket pc be this easy? I have developed app's for the Palm OS and naver had as much trouble as this. Why is it so overly complicated?

Thanks for your patience and help.

Mark

Tuesday, February 14, 2012

Best way to insert large amounts of data from a webform to SQL Server 2005

Hi

I have a VB.net web page which generates a datatable of values (3 columns and on average about 1000-3000 rows).

What is the best way to get this data table into an SQL Server? I can create a table on SQL Server no problem but I've found simply looping through the datatable and doing 1000-3000 insert statements is slow (a few seconds). I'd like to make this as streamlined as possible so was wondering is there is a native way to insert all records in a batch via ADO.net or something.

Any ideas?
Thanks
Ed

Hi,

If you gonna insert or update in single table then use SQL Data adapter. But it needs to have primary or unique key to create update query via sql command builder otherwise its just insert all rows in your table.

If you want to update for above scenario there are two ways.

1. Create staging table in your database and insert your records using sqlbulkcopy class which can insert lakhs of data/s (i'm not sure abt amt), then create a stored procedure to update or insert rows from staging table to main table

2. You can write your update and insert command in sqldataadapter.sqlcommand property.

for example

create a table as testtable with id number and name as text

Sql query will be like this

update testtable
set name = @.namecolumn
Where id = @.idColumn
If @.@.Rowcount = 0
Insert into testtable (id,name) values(@.idColumn,@.nameColumn)

then add sql parameters(@.idcolumn,@.nameColumn) with your data table column names

then adapter will execute the query while you call update method

hope it helps