Aspx, Mssql And Datetime

Nov 2, 2005

Hi, i am trying to retrive some datetime set from the database (2 posts in this table), senastposted is a datetime field.when i run:SELECT senastposted FROM ftp WHERE senastposted <= 2005-10-28i get this result:


senastposted
0 record(s) affected.and when i run: SELECT senastposted FROM ftp WHERE senastposted >= 2005-10-28i get this result:

senastposted
25-10-2005
29-10-2005
2 record(s) affected.what i want is to retrive the first value based on the date:25-10-2005any idea why SELECT senastposted FROM ftp WHERE senastposted <= 2005-10-28 dosent work?( i have tried to change the dates to 28-10-2005 and 28/10-2005)

View 3 Replies


ADVERTISEMENT

SQL Insert In Aspx.vb File (or Share Variable With .aspx Page)

Mar 14, 2008

Hi,I have a form page with an insert like this:<asp:SqlDataSource ID="addProductDataSource" runat="server"    InsertCommand="INSERT INTO test(        title1,        firstName1,        lastName1,        dateOfBirth    ) VALUES (        @title1,        @firstName1,        @lastName1        @dateOfBirth    )"     ConnectionString="<%$ ConnectionStrings:yourQuoteCentreConnectionString %>">        <InsertParameters>            <asp:ControlParameter ControlID="dateOfBirth" Name="dateOfBirth" Type="DateTime" />            <asp:ControlParameter ControlID="title1" Name="title1" PropertyName="Text" />            <asp:ControlParameter ControlID="firstName1" Name="firstName1" PropertyName="Text" />            <asp:ControlParameter ControlID="lastName1" Name="lastName1" PropertyName="Text" />        </InsertParameters></asp:SqlDataSource> In default.aspx.vb I have:Protected Sub Wizard1_FinishButtonClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.WizardNavigationEventArgs) Handles Wizard1.FinishButtonClick    'CREATE DATETIME FROM USERS BIRTH DATE        Dim dateOfBirth As New System.DateTime(applicantYear.SelectedValue, applicantMonth.SelectedValue, applicantMonth.SelectedValue, 0, 0, 0)    'INSERT TO DATABASE        addProductDataSource.Insert()End SubI would like to reference the variable dateOfBirth created in default.aspx.vb in the insert query on the page, or ideally move the insert query into the aspx.vb page.  Would this make more sense to do?Thanks,Paul

View 6 Replies View Related

MSSQL Datetime

Sep 5, 2006

Hi People

I've just imigrated from mysql to mssql, but i've a few problems when im converting my data.
When im trying to insert a date formated as yyyy-mm-dd hh:mm:ss intro a smalldate field, im just getting the following error:

Msg 170, Level 15, State 1, Line 3

Line 3: Incorrect syntax near '2006'.



Their isnt set any special settings on the db or the table, í've tried to google it, but widthout finding any solution.

Anybody have a idea of what im doing wrong?

Thanks in advance,

Torben

View 4 Replies View Related

DateTime -&> MSSQL -&> DateTime

Jun 9, 2008

Hi All,This is only my second day using C#/asp.net and English isn't my native language so I'll apologise in advance if this question doesn't make sense and/or is stupid . I'm trying to make a little event planner which was going well until I hit a small problem, the user needs to enter the event name and choose a date/time from dropdowns, this bit works okay... however I'm having difficulties with storing the date/time, at the moment I'm making a DateTime object and filling out the year/month/day/hour/minute selected on the form and adding that to the database field (which is a datetime field type).Problem is, I'm using the date format DD/MM/YYYY HH:MM:SS but the database stores it as MM/DD/YYYY HH:MM:SS so if I wanted to do things like:
select * from tbl where date > DateTime.Now - it isn't going to work because the month is switched with the day in the DB-versions.
Just to try and give another example, if I'm not being very clear, if I print DateTime.Now.ToString() it will display 10/06/2008 02:50:48 however if I put it into the database and pull it back out cast to a DateTime Object and then display that object via ToString() it'll be 06/10/2008 02:50:48
Any suggestions on what to do would be appreciated, usually in cases like this I'd just use the unix timestamp, but since C#/ASP.NET doesn't support that natively I was hoping there was an easier/native alternative. Also I don't have access to the server configuration so changing the localization of mssql isn't an option unfortunately.Thanks in advance!

View 7 Replies View Related

Wrong Datetime When Update Using MSSQL

Dec 11, 2005

Dim ldDatetime As DateTime = Now() '11/12/2005 13:05:09
my command text is:
"Insert Into WebSiteThread (TransactionDate) Values ( " & " ' " & ldDatetime & " ' " & ") "
The result I got was "12/11/3091 13:05:09" Not "11/12/2005 13:05:09"
What's wrong please!!
 

View 6 Replies View Related

How To Select The Time From DateTime Format (MSSQL) ???

Oct 31, 2006

Hi expert.. I am doing a project that have function to capture the Day and Night time talking duration of caller.... I make use of MSSQL to store the date time file..Let say I have this date: "2006-10-02 00:02:09".. How di I select "00:02:09" only???? Thanks in advancesuigion

View 2 Replies View Related

Mssql Won't Find NULL Values In Datetime Field??

Feb 13, 2007

Hi

I have a really simple query which i can't figure out why its not working. I have a table called 'ADMIN' which has a datetime field called 'date_edited'. Because the majority of records have never been edited, i have allowed null values and they are filled with 'NULL' in each record. How ever, when i try:

SELECT * FROM ADMIN WHERE date_edited = NULL

I get no records, but i can see and know i have hundreds! I know i'm doing somthing really stupid, but for life of me can't figure it out! :eek:

thanks

View 10 Replies View Related

Inserting And Retriving Datetime Field In Database MSSQL 2000

Jan 10, 2006

Hi, Assume I have a table name "myTime". This table is simply only have 1 (one) DATETIME field "MyTestTime" (also serve as a primary number).Table MyTime- MyTestTime : SQLTYPE DATETIMETo insert a new row into this field, I simply wrote :SqlCommand sqlCommand = new SqlCommand("insert into MyTime values('2006-01-09')", sqlConnection);
I got the value of "2006-01-09" from a textbox or other relevan control.I realize when I try to use "SELECT * FROM MyTime" statement, MSSQL server 2000 automatically convert my date value from "2006-01-09" to "01/09/2006" (from YYYY-MM-DD to MM/DD/YYYY). I don't know why this one must be converted to MM/DD/YYYY automatically (I believe this behavior is depend on some "setting option" in my MSSQL server - but I don't know which one).The challenge is :In my country, the actual date format is like German Date format (DD-MM-YYY). Well I know this is only "Customization" problem. But how insert datetime value given from sql query to a datetime variable?// Connect to database, make a query, get the datareader result, and bla bla blaDateTime aDateTime = new DateTime;aDateTime = Convert.ToDateTime(myDataReader["PostDate"].ToString());// close connectionMy question isHow can I make sure that aDateTime's day is 09 not 01. How my program know that 09 is day not month. I can't use string.split() method because it's possible that my database setting will change from "mm-dd-yyyy" to "dd-mm-yyyy"thanks

View 4 Replies View Related

Format DateTime Coulmn In Mssql 2005 Express Edition

Jan 1, 2008

hi ,
this is my first post on MS Forums .

Q: my question is that , i want to format a date column .. d/m/yyyy .. but there is no any format facility ..



anybody can help me here ??




View 1 Replies View Related

How Many Result-rows Does Mssql Return Should Be Used Asynchronous Method To Use Mssql Cursor?

Aug 11, 2004

How many result-rows does mssql return should be used asynchronous method to use mssql cursor, can get the best performance in any time in any result offset?

i want to make the cursor fast in any time whatever how many results returned

View 2 Replies View Related

Database Migration Plan - (mssql/msde To -&> Pgsql/mssql)

Feb 10, 2008

Hi,

i was planning to create a database migration tool ..
its a certain database of a DMS (document management system) to
another DMS (two different DMS)... from DMS using msde 2000 server .. and tranfer to a DMS using a postgre sql or mssql .. depends ..

they have different table structures and names . . :D

i was thing of what language shall i use.. or what language is the best to work on this kind of project :)

hoping for your kind help guys. thanks :)



br
Frozenice

View 1 Replies View Related

Trying To Use Contains(F1, ' This* ') In .ASPX

May 19, 2006

I'm trying to use a Select statement on Full-Text-Indexed field in SQL Server.The .aspx page does not like the " " inside my SQL statement. How do I get around this?Select parts.ProductNumber, T1.Description FROM T1, T2
WHERE T2.Ground='1' and T1.ProductNumber=T2.System and CONTAINS(T1.Description, '
"5001*" ')It does not like the " around the 5001* how do I escape them or whatever to make it work?- Rex

View 7 Replies View Related

Server Configuration For MSSQL 2000 And MSSQL 2005

Sep 6, 2006

Does enabling/disabling Data Execution Prevention have a performanceimpact on SQL 2000 or SQL 2005?For SQL best performance - how should I configure for:Processor Scheduling:Programs or Background servicesMemory Usage:Programs or System Cache

View 9 Replies View Related

Creating Index In MSSQL 2000 From MSSQL 2005

Mar 24, 2008

Hi,

I am a bit new to the MSSQL server. In our application, we use so many SQL queries. To imporve the performance, we used the Database enigine Tuning tool to create the indexes. The older version of the application supports MSSQL 2000 also. To re-create these new indexes, I have an issue in running these "CREATE INDEX" commands as the statements generated for index creation are done in MSSQL 2005. The statements include "INCLUDES" keyword which is supported in MSSQL 2005 but not in MSSQL 2000.

Ex:-

CREATE INDEX IND_001_PPM_PA ON PPM_PROCESS_ACTIVITY

(ACTIVITY_NAME ASC, PROCESS_NAME ASC, START_TIME ASC, ISMONITORED ASC)

INCLUDE

(INSTANCE_ID, ACTIVITY_TYPE, STATUS, END_TIME, ORGANIZATION);


Any help in creating such indexes in 2000 version is welcome.

Thanks,
Suresh.

View 2 Replies View Related

Generating Script For MSSQL 2000 From MSSQl 2005?

May 3, 2008

Hello
We are using SQL 2005 and now we are planning to use SQL 2000. what are the ways to do the process.

We taken the script spcificall for 2000 and run it in SQL 200. But we are getting the error in SCRIPT?

Could you please give me the step to do?

Thanks,
Sankar R

View 6 Replies View Related

Aspx Fashion Tip... ;)

Sep 19, 2006

Hi!Im building a site for internal use for a company i work at.And im having hard to decide what to do. The alternatives arecomma separated lists vs separate tables. For example.. I will use a number of different type of objekt that all will hold 1 or more document links, phone numbers, emails etcAs far as i can i i have 2 possibilitys. One is to add textfields for each of these subojects in each objects tables. Then i add all info as commaseparrated lists in 2-3 layers wich i then save in the respecive objects fields. (Look like something below for example ),comment'emailadress,comment'emailadress,Or i add 1 table for each subobject type wich manage the subobjects or link between different objectsfor example:table layout for email:id | parent_type | parent_id | comment | emailOr for example contacts a mediator table:id | parent_type | parent_id | contact_id Hope you understand what i mean, would really appriechiate suggestions, comments regarding what can be considered as "best practise" in these cases. Putting it in separate tables should make searches easier, and coding easier in my book. But again im thinking if perhaps commalists is a faster and more recource conservative way of doing it + to me it feels like (perhaps i have no reason to think this?) making tables for items like feels like a timebomb if you exhaust your idfields identity count. Though this app will be used by perhaps 100ppl at most so perhaps not an extremely utilized webapp.Anyway glad if you could give me some input! 

View 4 Replies View Related

Aspx And Sql 2005

Dec 6, 2007

I am trying to deploy an aspx application which talks to sql 2005. The application files are on a w2003 web server with asp.net 2.0 and the sql server is a 2003 server with sp1. when i attempt to browse this application i am prompted with "Unable to get records. Unable to connect to database. Login failed for user 'NT Authorityanonymous Logon'". The application is set to use windows authentication. However if i create the "anonymous" login in sql and make it a sysadmin, it works, of course. In my dev enviroment i have sql2005 and iis on same w2003 server and the same application WILL run and there is NO anonymous account, just using AD accounts.

View 2 Replies View Related

RunSQL.aspx Connection

Mar 16, 2008

Hello,
I am using the web blog at http://weblogs.asp.net/scottgu/archive/2007/01/11/tip-trick-how-to-upload-a-sql-file-to-a-hoster-and-execute-it-to-deploy-a-sql-database.aspx
to deploy an SQL script on my database. The sql script is named aspnetdb.sql and is placed in my main directory.
Now using the file RunSQL.aspx which is also placed in the main directory (www.genealogy-prototype.com/RunSQL.aspx) I have changed the parts in the file which need changing:// Url of the T-SQL file you want to run
string fileUrl = "http://genealogy-prototype.com/aspnetdb.SQL";

// Connection string to the server you want to execute against
string connectionString = @"Server=genealogy-prototype.com;User ID=marko;Password=
123;Initial Catalog=aspnetdb";but when I go to my page genealogy-prototype.com/RunSQL.aspx I am getting an error. However I'm not sure what this error is as it says I need to change custom errors to off in web.config, i have done this but it still says i have it on...
I'm guessing it must be something to do with the connection string i have given or the file url. My hosting company is freezone.co.uk, my ms sql database name is aspnetdb my username for this database it marko and there is no password. Is the connection string i have given wrong?
I have been trying this for over a week, any help would be great!!Thank you, Mark

View 4 Replies View Related

Executing Sql Scripts From Aspx....plz Help!

Apr 14, 2004

Hi All,
How to execute the sql scripts (which may be in .sql file or a string) from code behind files?

Thanx
Veeru.

View 2 Replies View Related

Stored Procedure To ASPX

Apr 28, 2004

Hello,

I have a stored procedure that is used to create a DataDictionary for the database. Basically, the sproc generates HTML and you can then run it from Query Analyzer by Saving to a file.

What I want to do is to run this from an aspx page.

The sproc uses PRINT to create the text.

Like this.


PRINT '<html>'
PRINT '<head>'
PRINT ' <title>SQL Server Data Dictionary Report - ' + @strDatabase + ' </title>'
PRINT '</head>'
PRINT '<body bgcolor="#FFFFFF" text="#000000" link="#008000" vlink="#008000">'
PRINT '<a name="Top"></a>'
PRINT '<div align="left">'


Is it possible to get the text that is generated from this sproc?

What do I need to do to get the text that has been created and display it on a page?

Thanks a lot.

View 2 Replies View Related

Aspx Vb Sql Parameter Passing

Aug 9, 2004

Hello,
Can someone kindly point out what is wrong with the following code file. I'm trying to:
- fill a dropdown from a db on page load (this works!)
- when user selects from the list and hits a button, pass the dropdown value to a second query
- use the second query to make another call to the db and fill a data grid

In the code below, if I swap an actual value (eg '1005') into the command and comment out the .Parameter.Add statements, the dategrid is filled sucessfully. Otherwise, when the button is pressed, nothing is displayed.

Thanks

PS comments about my coding approach are welcome - I'm new to aspx...




<%@ Language="VBScript" Debug="true"%>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.data.SqlClient" %>
<html>
<head>
<script language="vb" runat="server">
Dim dbConnection As SqlConnection
Dim ds_Teams,ds_Agents As DataSet
Dim sqlCmd_Teams,sqlCmd_Agents As SqlDataAdapter

Dim dbConn = "server=csacd01;uid=mpierce;pwd=cabledog;database=clearviewacd"

Dim sql_select_teams = "" & _
"SELECT team_no, team_name " & _
"FROM dbo.team " & _
"WHERE (team_status = 'Curr')"

Dim sql_select_agents = "" & _
"SELECT last_name + ', ' + first_name AS name, agent_no " & _
"FROM dbo.users " & _
"WHERE (team_no = @Team) AND (NOT (agent_no = '1029')) " & _
" AND (NOT (last_name IS NULL)) " & _
" AND (NOT (first_name IS NULL)) " & _
" AND (NOT (first_name = 'FirstName')) " & _
"ORDER BY last_name"


Dim teamList = "teamList"
Dim agentList = "agentList"

Sub Page_Load(Sender As Object, E As EventArgs)
if not (IsPostBack)
ds_Teams = new DataSet()
dbConnection = New SqlConnection(dbConn)
sqlCmd_Teams = New SqlDataAdapter(sql_select_teams, dbConnection)
sqlCmd_Teams.Fill(ds_Teams, teamList)
dbConnection.close()

dropdownlist_Teams.DataSource=ds_Teams.Tables(teamList).DefaultView
dropdownlist_Teams.DataBind()
end if
End Sub

sub Get_Agents(Sender As Object, E As EventArgs)
ds_Agents = new DataSet()
dbConnection = New SqlConnection(dbConn)
sqlCmd_Agents = new SqlDataAdapter(sql_select_agents, dbConnection)

sqlCmd_Agents.SelectCommand.Parameters.Add(new SqlParameter("@Team", SqlDbType.NVarChar,4))
sqlCmd_Agents.SelectCommand.Parameters("@Team").Value = dropdownlist_Teams.DataValueField

sqlCmd_Agents.Fill(ds_Agents,agentList)

dbConnection.close()

datagrid_Agents.DataSource=ds_Agents.Tables(agentList).DefaultView
datagrid_Agents.DataBind()
end sub

</script>
</head>
<body>
<form runat="server">
<asp:DropDownList id="dropdownlist_Teams" runat="server"
DataTextField="team_name"
DataValueField="team_no">
</asp:DropDownList>

<input type="submit" onserverclick="Get_Agents" value="Get Agents" runat="server"><br />


<ASP:DataGrid id="datagrid_Agents" runat="server"
Width="500"
BackColor="#ccccff"
BorderColor="black"
ShowFooter="false"
CellPadding=3
CellSpacing="0"
Font-Name="Verdana"
Font-Size="8pt"
HeaderStyle-BackColor="#aaaadd"
EnableViewState="false"
/>
</form>
</body>
</html>

View 1 Replies View Related

Sql Problem When I Run My Aspx Located In My IIS 5.0

Sep 10, 2004

Hi! i'm dani, from spain. I´m looking for sombody to help me.
The trouble is as i have indicated. I get the next error when my page aspx needs to acced to the SQL Bd:
"Error of beginning of session of the user '(null)'. Reason: it is not associate to a connection of confidence SQL Server."
I hope a reply.
Thanks and greethings.

View 1 Replies View Related

Aspx With IIS6 With SQL 2000

Jun 3, 2005

Hi All,I am trying to run aspx website on IIS version 6. It works locally with WEb Matrix but when I put the site into the IIS server, it cannot connect to the database. THe IIS is sonfigured and all users have full permissions but the error that is returned is:Login failed for user '(null)'. Reason: Not associated with a treusted SQL Server connection.SQL Server 2000 is installed and a connection is open to the database in question. Would be very greatfull for ANY help on this, being tryin to get this workin for days!!Collette.

View 3 Replies View Related

RunSQL.aspx Connection

Mar 16, 2008

Hello,

I am using the web blog at http://weblogs.asp.net/scottgu/archive/2007/01/11/tip-trick-how-to-upload-a-sql-file-to-a-hoster-and-execute-it-to-deploy-a-sql-database.aspx

to deploy an SQL script on my database. The sql script is named aspnetdb.sql and is placed in my main directory.

Now using the file RunSQL.aspx which is also placed in the main directory (www.genealogy-prototype.com/RunSQL.aspx) I have changed the parts in the file which need changing:

// Url of the T-SQL file you want to run
string fileUrl = "http://genealogy-prototype.com/aspnetdb.SQL";

// Connection string to the server you want to execute against
string connectionString = @"Server=genealogy-prototype.com;User ID=marko;Password=</span>
<span lang=EN>123;Initial Catalog=aspnetdb";

but when I go to my page genealogy-prototype.com/RunSQL.aspx I am getting an error. However I'm not sure what this error is as it says I need to change custom errors to off in web.config, i have done this but it still says i have it on...

I'm guessing it must be something to do with the connection string i have given or the file url. My hosting company is freezone.co.uk, my database name is aspnetdb my username for this database it marko and there is no password. Is the connection string i have given wrong?

I have been trying this for over a week, any help would be great!!
Thank you, Mark

View 1 Replies View Related

Run Mssql 6.5 Client And Mssql 7.0 Server On Same Nt Workstaton?

Oct 26, 1999

Hello:

I am currently work on mssql 6.5. On my workstation, I have mssql 6.5
cient software.

However, I would like to install mssql 7.0 server on my nt workstation
and work with it to become familiar with 7.0. Can I install mssql 7.0
server on my nt workstation? Can mssql 6.5 client coexist with mssql 7.0
on the same machine if they are in different directories?

Thanks.

David Spaisman

View 1 Replies View Related

MSSQL Express 2005 Vs. MSSQL 2000

Jun 15, 2006

Ben writes "I have a sql script that doesn't function very well when it's executed on a SQL 2000 server.

The scrpt looks like this:


---------------------------------------------------------------------------------------------------
USE [master]
GO
IF NOT EXISTS (SELECT * FROM master.dbo.syslogins WHERE loginname = N'SSDBUSERNAME')
EXEC sp_addlogin N'SSDBUSERNAME', N'SSDBPASSWORD'
GO
GRANT ADMINISTER BULK OPERATIONS TO [SSDBUSERNAME]
GO
GRANT AUTHENTICATE SERVER TO [SSDBUSERNAME]
GO
GRANT CONNECT SQL TO [SSDBUSERNAME]
GO
GRANT CONTROL SERVER TO [SSDBUSERNAME]
GO
GRANT CREATE ANY DATABASE TO [SSDBUSERNAME]
GO
USE [master]
GO
If EXISTS (Select * FROM master.dbo.syslogins WHERE loginname = N'SSDBUSERNAME')
ALTER LOGIN [SSDBUSERNAME] WITH PASSWORD=N'SSDBPASSWORD'
GO
GRANT ADMINISTER BULK OPERATIONS TO [SSDBUSERNAME]
GO
GRANT AUTHENTICATE SERVER TO [SSDBUSERNAME]
GO
GRANT CONNECT SQL TO [SSDBUSERNAME]
GO
GRANT CONTROL SERVER TO [SSDBUSERNAME]
GO
GRANT CREATE ANY DATABASE TO [SSDBUSERNAME]
GO
USE [master]
GO
IF EXISTS (select * from dbo.sysdatabases where name = 'ISIZ')
DROP DATABASE [ISIZ]
GO
USE [SurveyData]
GO
exec sp_adduser 'SSDBUSERNAME'
GRANT INSERT, UPDATE, SELECT, DELETE
TO SSDBUSERNAME
GO
USE [SurveyManagement]
GO
exec sp_adduser 'SSDBUSERNAME'
GRANT INSERT, UPDATE, SELECT, DELETE
TO SSDBUSERNAME
---------------------------------------------------------------


I need to be converted to a script that can be executed on both MSSQL 2000 and MSSQL 2005.

I was wondering if somebody there could help me with this problem?!

Thanks,
Ben"

View 1 Replies View Related

Migration MSSQL 2000 32-bit To MSSQL 2005 64-bit

Nov 17, 2007

I've been tasked to move our production databases on MSSQL 2000 to 2005. I've supported MSSQL since version 6.5 and performed migrations to successor versions.

Current Environment is MSSQL 2000 32-bit with current Service Packs.

I've performed mock migrations on Test servers upgrading all Production instances simultaneously from MSSQL 2000 to 2005 32-bit. The Test environment is identical to Production minus server name, IP etc. Also I have a separate server with MSSQL 2005 installed where I use the DETACH / ATTACH and BACKUP / RESTORE method for migration / acceptance testing. There are approximately 30 databases totaling 70 GB. This has gone as expected and fairly successful. Vendors have been coordinated with to update code and staff for acceptance testing.

I'd prefer going directly to MSSQL 2005 64-bit instead if possible due to memory benefits etc. This is where I'd like some feedback prior to borrowing a 64-bit server for testing.

Upgrade options:

1. Is it better to migrate from MSSQL 2000 32-bit to 2005 64-bit via:
a. DETACH / ATTACH
b. BACKUP / RESTORE
c. Is one method more advantageous relating to the end result?
2. Regarding XP clients, have issues been experienced with the default SQL Server driver or is an alternate recommended for XP clients to connect to a MSSQL 64-bit server databases?
3. If you have performed this migration and have relevant experience please pass them along.

View 3 Replies View Related

How To Use Joins In SQL Statements In .aspx Page?

Nov 22, 2006

Hi can someone help me?
I'm using Access database and Microsoft VS2005 (VB)
I need to take data from 2 different tables in 1 database. But i can't seems to get it right!
I have: - dbWarehouse.mdb- tblReadDetails and tblStock
I need to use "Barcode" from tblReadDetails, compare it with "Barcode" in tblStock then retrieve all the column in tblStock and put it in a webpage.aspx list box.
I tried the following code...cn.ConnectionString = strConncn.Open()cmd = New OleDbCommand("SELECT tblStock.Barcode, tblStock.Item, tblStock.Dept, tblReadDetails.Barcode FROM tblStock JOIN tblReadDetils WHERE tblReadDetails.Barcode = tblStock.Barcode", cn)dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)While dr.Read()lstBarcode.Items.Add(dr2.Item("tblStock.Barcode"))lstItem.Items.Add(dr2.Item("tblStock.Item"))lstDept.Items.Add(dr2.Item("tblStock.Dept"))End While
but it prompt me the following error...
OleDbException was unhandled by user codeSyntax error in FROM clause
What's wrong with this code?
Regards and thanks!

View 2 Replies View Related

Get Rid Of Time From SQL Server's Data By Using ASPX

Mar 20, 2007

Hi,
I have the problem in accessing data from MS-SQL server by using Dreamwearver MX 's VB.NET page. Although it works well, in the date format, it also display time. Please see the following code.
SELECT student_ID, Material_ID, Borrow_Date, Due_Date, Renew_Date, Status, include_withFROM dbo.RecordWHERE student_ID = @student_ID
To remove time, I added the following code as follows. After that, I can preview and works well without having time.
SELECT student_ID, Material_ID, convert(varchar(10),Borrow_Date,103), convert(varchar(10),Due_Date,103), convert(varchar(10),Renew_Date,103), Status, include_withFROM dbo.RecordWHERE student_ID = @student_ID
But, when I browse, I get the runtime error. When I look more details in server, the error said " Parser Error Message: The server tag is not well formed." and error in  <MM:DataSet"
Please help me.
Jon

View 3 Replies View Related

Connecting Aspx To SQL Server 2000

Jul 24, 2007

Hello All,
 I am just getting started on aspx, coming from an asp background.
I created the following connectionString in my web.config file:<connectionStrings>
<add name="OuWebDB"
connectionString="server=OurServer;database=OurDatabase;uid=TheUser;pwd=ThePassword"providerName="System.Data.SqlClient"
/>
</connectionStrings>
 
when I run this aspx file, from a machine, I get the following error:
An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Help!!
 
thanks

View 3 Replies View Related

Execute DTS Package At Aspx Code Behind

Mar 26, 2008

Hi all,
I am excuting DTS package from code behind and the table is created in the SQL database. However, the data in my excel sheet is not transferred over and Im not sure where the problem lies. Below is my code:
  pkgLocation = @"C:/Program Files/test.dtsx";
app = new Application();
pkg = app.LoadPackage(pkgLocation,null);
pkgResults = pkg.Execute(); Any advice is much appreciated.

View 4 Replies View Related

Execute A *.sql File From One Aspx Page

Mar 12, 2004

Hi,
like subject, is it possible?

bye

View 3 Replies View Related

Calling Store Procedure From Aspx

Jun 7, 2004

hi , I would appreicate your help, I have created a store procedure in MS sql server 2000 to be called from aspx page.
The store procedure will have multiple functions:
checking if a file exist in c:data
if file exist, it will use zip file command line to unzip the file and then run DTS package to upload the database.

The issue I am having is when I run the store procedure from MS query analyzer,I get a confirmation that the whole procedure ran successfully, but when I call the same procedure from aspx, althought the store procedure ran successfully, but I did not get any confirmation to the user in the aspx page to notify the user that the process successed.... here is my code in where I think is not working,
CREATE PROCEDURE p_on_demand_dts_sales_option_price_report_3_ftest
@id int , @msg_output varchar(28) output
as
declare @varcmd varchar(255),@FileExist int
select @varcmd = null
select @varcmd ='dir :Data_on_demandsales_option_price_report.csv' -- check if file exist
EXEC @FileExist = master..xp_cmdshell @varcmd
set @msg_output = 'The file exists'
Return 44

+++ The above store procedure use command line to check if the csv file exist, its suppose will return a output parameter and a return # BUT it did not. To my surprise, when I modify the above store procedure like this, it work
-----
CREATE PROCEDURE p_on_demand_dts_sales_option_price_report_3_ftest
@id int , @msg_output varchar(28) output
as
set @msg_output = 'The file exists'
Return 44

The second procedure does not do anything, except take input parameter and return a message output and return, this work.

since the second procedure works, it means that the code in aspx is correct, but I have no clue why it does not return output parameter and return # in the first procedure.

I would really appreciate anyone who could help.
thanks

ehx5

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved