SQL 2005 Insert Code Help Required

Dec 21, 2007

Hi I am trying to inset data to my sql 2005 database using a webform.. the code I have is

 
3    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
4   
5    ConnectionString="<%$ ConnectionStrings:SQL2005440975 %>"
6   
7    InsertCommand="INSERT INTO [dbo.asp.net_Addresstbl] ([Salutation], [fname], [sname], [Daydb], [Monthdb], [Yeardb], [txtOrg], [txtLine1], [txtLine2], [txtLine3], [txtTown], [txtPostcode], [UserID])
8   
9    VALUES (@Salutation, @fname, @sname, @Daydb, @Monthdb, @Yeardb, @txtOrg, @txtLine1, @txtLine2, @txtLine3, @txtTown, @txtPostcode, @UserID)"
10  
11   <InsertParameters>
12                                           <asp:FormParameter FormField="Salutation" Name="Salutation" Type="String" />
13                                           <asp:FormParameter FormField="fname" Name="fname" Type="String" />
14                                           <asp:FormParameter FormField="sname" Name="sname" Type="String" />
15                                           <asp:FormParameter FormField="Daydb" Name="Daydb" Type="Decimal" />
16                                           <asp:FormParameter FormField="Monthdb" Name="Monthdb" Type="String" />
17                                           <asp:FormParameter FormField="Yeardb" Name="Yeardb" Type="Decimal" />
18                                           <asp:FormParameter FormField="txtOrg"Name="txtOrg" Type="String" />
19                                           <asp:FormParameter FormField="txtLine1" Name="txtLine1" Type="String" />
20                                           <asp:FormParameter FormField="txtLine2" Name="txtLine2" Type="String" />
21                                           <asp:FormParameter FormField="txtLine3" Name="txtLine3" Type="String" />
22                                           <asp:FormParameter FormField="txtTown" Name="txtTown" Type="String" />
23                                           <asp:FormParameter FormField="txtPostcode"Name="txtPostcode" Type="String" />
24                                           <asp:FormParameter FormField="UserID" Name="UserID" Type="Object" />
25   </InsertParameters>
26   </asp:SqlDataSource>
27  
28   <asp:DropDownList ID="Salutation" runat="server" ValidationGroup="Address">
29                                   <asp:ListItem>Choose One</asp:ListItem>
30                                   <asp:ListItem>Mr.</asp:ListItem>
31                                   <asp:ListItem>Mrs.</asp:ListItem>
32                                   <asp:ListItem>Ms.</asp:ListItem>
33                                   <asp:ListItem>Miss.</asp:ListItem>
34                                   <asp:ListItem>Rev.</asp:ListItem>
35                                   <asp:ListItem>Doc.</asp:ListItem>
36                                   <asp:ListItem>Other.</asp:ListItem>
37                               </asp:DropDownList>
38  
39   <asp:TextBox ID="fname" runat="server" CausesValidation="True"></asp:TextBox>
40  
41   <asp:TextBox ID="sname" runat="server" CausesValidation="True"></asp:TextBox>
42  
43   <asp:DropDownList ID="Daydb" runat="server" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
44                                   <asp:ListItem>Day</asp:ListItem>
45                                   <asp:ListItem>01</asp:ListItem>
46                                   <asp:ListItem>02</asp:ListItem>
47                                   <asp:ListItem>03</asp:ListItem>
48                                   <asp:ListItem>04</asp:ListItem>
49                                   <asp:ListItem>05</asp:ListItem>
50                                   <asp:ListItem>06</asp:ListItem>
51                                   <asp:ListItem>07</asp:ListItem>
52                                   <asp:ListItem>08</asp:ListItem>
53                                   <asp:ListItem>09</asp:ListItem>
54                                   <asp:ListItem>10</asp:ListItem>
55                                   <asp:ListItem>11</asp:ListItem>
56                                   <asp:ListItem>12</asp:ListItem>
57                                   <asp:ListItem>13</asp:ListItem>
58                                   <asp:ListItem>14</asp:ListItem>
59                                   <asp:ListItem>15</asp:ListItem>
60                                   <asp:ListItem>16</asp:ListItem>
61                                   <asp:ListItem>17</asp:ListItem>
62                                   <asp:ListItem>18</asp:ListItem>
63                                   <asp:ListItem>19</asp:ListItem>
64                                   <asp:ListItem>20</asp:ListItem>
65                                   <asp:ListItem>21</asp:ListItem>
66                                   <asp:ListItem>22</asp:ListItem>
67                                   <asp:ListItem>23</asp:ListItem>
68                                   <asp:ListItem>24</asp:ListItem>
69                                   <asp:ListItem>25</asp:ListItem>
70                                   <asp:ListItem>26</asp:ListItem>
71                                   <asp:ListItem>27</asp:ListItem>
72                                   <asp:ListItem>28</asp:ListItem>
73                                   <asp:ListItem>29</asp:ListItem>
74                                   <asp:ListItem>30</asp:ListItem>
75                                   <asp:ListItem>31</asp:ListItem>
76                               </asp:DropDownList>
77  
78   <asp:DropDownList ID="Monthdb" runat="server" style="text-align: left">
79                                   <asp:ListItem>Month</asp:ListItem>
80                                   <asp:ListItem>January</asp:ListItem>
81                                   <asp:ListItem>February</asp:ListItem>
82                                   <asp:ListItem>March</asp:ListItem>
83                                   <asp:ListItem>April</asp:ListItem>
84                                   <asp:ListItem>May</asp:ListItem>
85                                   <asp:ListItem>June</asp:ListItem>
86                                   <asp:ListItem>July</asp:ListItem>
87                                   <asp:ListItem>August</asp:ListItem>
88                                   <asp:ListItem>September</asp:ListItem>
89                                   <asp:ListItem>October</asp:ListItem>
90                                   <asp:ListItem>November</asp:ListItem>
91                                   <asp:ListItem Value="12">December</asp:ListItem>
92                               </asp:DropDownList>
93  
94   <asp:DropDownList ID="Yeardb" runat="server" style="text-align: left"
95                                   OnSelectedIndexChanged="Year_SelectedIndexChanged"
96                                   DataSourceID="YearDataSource" DataTextField="Year" DataValueField="Year">
97                                   <asp:ListItem Selected="True">Choose Year..</asp:ListItem>
98   </asp:DropDownList>
99         <asp:AccessDataSource ID="YearDataSource" runat="server"
100        DataFile="~/App_Data/year.mdb" SelectCommand="SELECT [Year] FROM [Year]">
101        </asp:AccessDataSource>
102                         
103  <asp:TextBox ID="txtFind" runat="server" CausesValidation="True" ValidationGroup="address"></asp:TextBox>
104 
105  <asp:Button ID="btnFind" runat="server" Text="Find"
106       OnClick="btnFind_Click" ValidationGroup="address"
107           OnClientClick="lstProperties" />
108                     
109 
110          <asp:ListBox ID="lstProperties" runat="server" AutoPostBack="True"
111                   OnSelectedIndexChanged="lstProperties_SelectedIndexChanged" Visible="False"
112                                  Width="200px"></asp:ListBox>
113                         
114                              <asp:TextBox ID="txtOrg" runat="server" OnTextChanged="txtOrg_TextChanged"
115                                  ReadOnly="True" ValidationGroup="address2" Visible="False"></asp:TextBox>
116                         
117                              <asp:TextBox ID="txtLine1" runat="server" ReadOnly="True" Visible="False"></asp:TextBox>
118                         
119                              <asp:TextBox ID="txtLine2" runat="server" ReadOnly="True" Visible="False"></asp:TextBox>
120                         
121                              <asp:TextBox ID="txtLine3" runat="server" ReadOnly="True" Visible="False"></asp:TextBox>
122                         
123                              <asp:TextBox ID="txtTown" runat="server" ReadOnly="True" Visible="False"></asp:TextBox>
124                         
125                              <asp:TextBox ID="txtPostcode" runat="server" ReadOnly="True" Visible="False"></asp:TextBox>
126                         
127                              <asp:Label ID="lblAddress" runat="server" CssClass="style9"></asp:Label>
128                                         
129                              <asp:Button ID="submitaddress" runat="server" Text="Add Details"
130                                  style="text-align: centre" CommandName="Submit"
131                                  ValidationGroup="address" PostBackUrl="~/MemberPages/account.aspx" />
132 
133  </asp:Content>


 Will this code work? if not can you explain why not and offer an example that will work. In the mean time I am reading up on these insert statements.

 

Regards

Mal

View 5 Replies


ADVERTISEMENT

What Code Is Required To Use The Trigger With The Application Of .NET && SQL 2005

Apr 22, 2007

Hi Everyone,        I m using ASP.NET 2005 with C# and SQL SERVER 2005.        I m using stored procedure and sql datasource control to retrieve the data.        I want to use the trigger alongwith storedprocedure.        I have created the following trigger on emp_table. CREATE TRIGGER Employeee on emp_tableAFTER DELETE ASDECLARE @empid int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SELECT @empid=empid from emp_table where locationid=(SELECT locationid from deleted)IF @@ROWCOUNT=0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DELETE FROM location_table where locationid=(SELECT locationid from deleted)What i wanted to know is how can i use it with asp.net and sql server 2005 when any update,delete or insert query is executed thru the stoed procedure...What code is required to use the trigger with the application of .NET thanxs.....

View 2 Replies View Related

SQL Server 2000 To SQL Server 2005 - Any Changes Required To Existing Code, System.Data.SqlClient.SqlConnection?

Dec 13, 2007

My web project (ASP.NET 2.0 / C#) runs against sql server 2000 and uses the System.Data.SqlClient.using System.Data.SqlClient;
 I use System.Data.SqlClient.SqlConnection and System.Data.SqlClient.SqlCommand to make the connections to the database and do selects and updates.  Is it correct to continue to use these against SQL Server 2005?  I ask because I made a connection string (outside of .Net) for SqlServer 2005 using the SQL native provider and it had the following - Provider=SQLNCLI.1 and any connection strings I had made (also outside of ASP.NET) fro SQL Server all used Provider=SQLOLEDB.1.  This is why I wondered if there is a different SqlClient in .Net 2.0 for SQL Server 2005?
Cheers
Al

View 1 Replies View Related

Insert Images In SQL 2005 Express DB, Using C# Code For Asp.net 2.0 (VS 2005)

Aug 31, 2006

Help!

I found about a dozen samples and articles in the net about inserting images in a sql database, but they were either using VB, or asp only or SQL 2000 and although I tried them all, none worked...
Can you help me by posting some code on how to insert images in SQL 2005, using C# in Visual Studio 2005 (asp.net 2.0)

Thanks.

View 11 Replies View Related

Help Required In ASP.NET Code

Jul 26, 2006

I am writting a very simple ASP.NET code, I am simlply trying to
establish a connection with the database in SQL Server 2000 and than
closing the connection but still I am getting an exception,the name of
the database is mydatabase, SQL Server 2000 is running in the windows
authenticationfiltered=SSPI. The name of SQL Server 2000 running
onfiltered=xyz,
I checked the name from SQL Server Service Manager.Also I would like to
state here that I also tryed to establish a connection using C# and the
connection was successfully establish which means that there is no
problem with SQL Server also I sucessfully established the connection
with MS Access and my ASP.NET application which proves that there is no
problem with IIS also.Also please check that the connection string
which I am providing is correct or not.The exception which I am getting
is as follows:
///////////////////////////////////////////////////////////////////////////////
An exception occured while establishing connection
Login failed for user 'xyzASPNET'.
////////////////////////////////////////////////////////////////////////////
Please also note that I have a user with the name xyz/Administrator in
the logins of Sql Server 2000. Also note one more thing that the name
of my PC is xyz, I think that there is some problem with the connection
string which i am providing so please especially check the connection
string that either I have missed some thing or some thing has gone
wrong,also please tell that are there any security restructions for
ASP.NET to access SQL Server 2000 or some thing like that which I have
to remove.The code is as follows:
//////////////////////////////////////////////////////////////////////////////////////
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>

void Page_Load(Object sender , EventArgs e)
{
try
{
SqlConfiltered=new SqlConnection("server=xyz;Integrated Security=SSPI;database=mydatabase;");
connection.Open();
Response.Write("<b>Connection is successfully established</b>");
connection.Close();
}
catch(Exception ex)
{
Response.Write("<b>An exception occured while establishing connection</b><br>"+" "+ex.Message.ToString());
}
}
</Script>

The same above code is also present in the attachement file data.aspx ,
please guide me where I am making mistake and please tell me that how
can I correct this mistake so that the code executes correctly.Also
please tell that what things should be included in the connection
string and also please check the connection string of this code.

View 1 Replies View Related

Source Code Required

Feb 18, 2004

A Source code required for create SQL Server Database,Tables,Procedures programatically

View 1 Replies View Related

VC++ Multipage Document Priting Code/URL/Book Required.

May 21, 2008

hi,

Where can I get the Complete code/URL/ Good BOOK for the Print,Print Priview for the CV++ "multipage printing" concept.

thanks
murthy

View 2 Replies View Related

Insert :) I Have Different Insert Code Lines (2 Insert Codelines) Which One Best ?

Jun 4, 2008

hello friends
my one insert code lines is below :) what does int32 mean ? AND WHAT IS DIFFERENT BETWEEN ONE CODE LINES AND SECOND CODE LINES :)Dim conn As New SqlConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString)
Dim cmd As New SqlCommand("Insert into table1 (UserId) VALUES (@UserId)", conn)
'you should use sproc instead
cmd.Parameters.AddWithValue("@UserId", textbox1.text)
'your value
Try
conn.Open()Dim rows As Int32 = cmd.ExecuteNonQuery()
conn.Close()Trace.Write(String.Format("You have {0} rows inserted successfully!", rows.ToString()))
Catch sex As SqlExceptionThrow sex
Finally
If conn.State <> Data.ConnectionState.Closed Then
conn.Close()
End If
End Try
MY SECOND INSERT CODE LINES IS BELOWDim SglDataSource2, yeni As New SqlDataSource()
SglDataSource2.ConnectionString = ConfigurationManager.ConnectionStrings("ConnectionString").ToString
SglDataSource2.InsertCommandType = SqlDataSourceCommandType.Text
SglDataSource2.InsertCommand = "INSERT INTO urunlistesi2 (kategori1) VALUES (@kategori1)"
SglDataSource2.InsertParameters.Add("kategori1", kategoril1.Text)Dim rowsaffected As Integer = 0
Try
rowsaffected = SglDataSource2.Insert()Catch ex As Exception
Server.Transfer("yardim.aspx")
Finally
SglDataSource2 = Nothing
End Try
If rowsaffected <> 1 ThenServer.Transfer("yardim.aspx")
ElseServer.Transfer("urunsat.aspx")
End If
 
 
cheers

View 2 Replies View Related

How To Run Insert Query For Required No.of Times With Different Parameters...?

Apr 22, 2008

Hi All,

I have two tables in my database.
I want to insert date and no.of hours worked on that day for a particular project.
So in a week if end user enters 7 dates and hrs for each day......
i have to insert those values into the table against one project only.
Can any one please help me out how to run insert query for 7 times (in a week) with different parameters

Thanks,
Praveen

View 5 Replies View Related

Help With Converting Code: VB Code In SQL Server 2000-&&>Visual Studio BI 2005

Jul 27, 2006

Hi all--I'm trying to convert a function which I inherited from a SQL Server 2000 DTS package to something usable in an SSIS package in SQL Server 2005. Given the original code here:
Function Main()
on error resume next
dim cn, i, rs, sSQL
Set cn = CreateObject("ADODB.Connection")
cn.Open "Provider=sqloledb;Server=<server_name>;Database=<db_name>;User ID=<sysadmin_user>;Password=<password>"
set rs = CreateObject("ADODB.Recordset")
set rs = DTSGlobalVariables("SQLstring").value

for i = 1 to rs.RecordCount
sSQL = rs.Fields(0).value
cn.Execute sSQL, , 128 'adExecuteNoRecords option for faster execution
rs.MoveNext
Next

Main = DTSTaskExecResult_Success

End Function

This code was originally programmed in the SQL Server ActiveX Task type in a DTS package designed to take an open-ended number of SQL statements generated by another task as input, then execute each SQL statement sequentially. Upon this code's success, move on to the next step. (Of course, there was no additional documentation with this code. :-)

Based on other postings, I attempted to push this code into a Visual Studio BI 2005 Script Task with the following change:

public Sub Main()

...

Dts.TaskResult = Dts.Results.Success

End Class

I get the following error when I attempt to compile this:

Error 30209: Option Strict On requires all variable declarations to have an 'As' clause.

I am new to Visual Basic, so I'm on a learning curve here. From what I know of this script:
- The variables here violate the new Option Strict On requirement in VS 2005 to declare what type of object your variable is supposed to use.

- I need to explicitly declare each object, unless I turn off the Option Strict On (which didn't seem recommended, based on what I read).

Given this statement:

dim cn, i, rs, sSQL

I'm looking at "i" as type Integer; rs and sSQL are open-ended arrays, but can't quite figure out how to read the code here:

Set cn = CreateObject("ADODB.Connection")

cn.Open "Provider=sqloledb;Server=<server_name>;Database=<db_name>;User ID=<sysadmin_user>;Password=<password>"

set rs = CreateObject("ADODB.Recordset")

This code seems to create an instance of a COM component, then pass provider information and create the recordset being passed in by the previous task, but am not sure whether this syntax is correct for VS 2005 or what data type declaration to make here. Any ideas/help on how to rewrite this code would be greatly appreciated!

View 7 Replies View Related

Bandwidth Required .NET 2 And SQL 2005

Aug 3, 2007

Hi there SQL Team

I hope I’ve posted this in the right section.

We have a customer, call them customerA
CustomerA has just employed a new Chief Information Officer.

The New CIO would like to make a few changes to the current way we have things right now.
Bare with me as I explain our environment.

We have The following Servers

Application Server[FSS (Dual DC Xeon 2.33GHz CPU, 4GB RAM, 3x72GB hdd RAID]
Database Server [FSS (Dual DC Xeon 2.33GHz CPU, 4GB RAM, 3x72GB hdd RAID)]

Both the above servers sit in a fully fault tolerant environment with daily backups power generators etc etc etc.1000MB network everything work 100%

Now my question:

The new CIO would like to move the DB server out of this environment to a remote building downtown, and have the application server connect to this remote db server.
Is this advisable?
What are the required connection speeds, so that the end user does not have to wait for a response?
What is the recommended response time IIS should give?

Please also note that we are in South Africa and broadband is VERY expensive / unreliable.

The CIO would like to install a 2Mbit radio link from this building to the ISP I’m not sure on the cost, but do know that this type of link is very unstable,
Their failover will be a 512kb fixed line or diginet line. Cost about ZAR 8000.00 per month

The application is extremely data / graphs intensive as it contain property information.
I think they average about 16000 visitors daily, not a lot.

If anyone can give me any input i would appreciated.

Thanks

View 1 Replies View Related

SQL 2005 Database Mirroring - AD Required?

Oct 10, 2005

Hi, for SQL 2005 - to set up database mirroring, is it required to have Active Directory installed or to be part of a domain? I am looking to use a workgroup with the SQL machines only and to not reference any domain and cannot find this information - is this possible?

View 5 Replies View Related

Help Required Please + SQL Server 2005 + LIKE Query

Jan 10, 2008


Hi Guys

I am in need of some assistance please.

I am using SQL Server 2005 and C#(winforms).

For example if I have a winform with a textbox and search button. If I type in ABCD1234. I won't know what the data is coming into the X Table. So there will be hundreds of description data in the description field in X table.

So in the X Table, there are ABCD1234,ABCD_1234,ABCD/1234,ABCD 1234

But I will only pick this 'ABCD1234' record up, and the rest won't be picked. They are variations of the same description. It needs to pick also ABCD_1234,ABCD/1234,ABCD 1234

If also type in 5678, in another column like code in X Table. It would have 005678,05678,56780. But I will only pick this '5678' record up, and the rest won't be picked. They are variations of the same code.
It needs to pick also 005678,05678,56780

I have tried LIKE, FREETEXT and CONTAINS.

But another idea is a table of alternate descriptions for those that you know about and look those up and search for them all. But how can that be done?

Any ideas guys please? with examples if possible.

Thanks Newbie.....

View 4 Replies View Related

Is IIS Required In Sql Server 2005 Installation?

Nov 27, 2007

I thought it was but I just now installed it on a box without IIS. I gather IIS is not a requried component. I noticed only Reporting Services Requires it so I am hoping that installing IIS and then add Reporting Services Component later will not cause configuration problems.

View 3 Replies View Related

Information Required About SQL Server 2005 Reporting

Dec 17, 2007



Hi Friends,



I was in the phase of switching over to Sql Server Reporting from the normal reports. I plan to go with the SQL server 2005 standard version. Do i need visual studio 2005 to design and deploy report. If I am using only SQL server standard alone for my reporting and publishing, is it possible to assign the user rights to reports, user can just login and can view all the reports that belongs to that user. Since I wont be using the visual Studio 2005, so I want to implement this using the SQL server 2005. So pls help me with your kind information how to proceed ahead.



Thanks,

Sreekoo.



View 1 Replies View Related

Help Required In Import Data Into Sql 2005 From Excel 4.0

Sep 20, 2006

Hi
I have to import data from a number of excel files to corresponding tables in SQL 2005. The excel files are created using excel 4.0. I have created an excel connection manager and provided it with the path of the excel sheet.Next i have added an excel source from the toolbox to the dataflow. I have set the connection manger, data access mode, and the name of the excel sheet (the wizard detects the sheet correctly) in the dialog window i get when i double click the excel source. Every thing goes fine till here. Now when i select the 'columns' in this dialog window or the preview button, i get this error
TITLE: Microsoft Visual Studio------------------------------Error at Data Flow Task [Excel Source [1]]: An OLE DB error has occurred. Error code: 0x80004005.Error at Data Flow Task [Excel Source [1]]: Opening a rowset for "test4$" failed. Check that the object exists in the database.------------------------------ADDITIONAL INFORMATION:Exception from HRESULT: 0xC02020E8 (Microsoft.SqlServer.DTSPipelineWrap)------------------------------
Any ideas about why is this happening???
Umer

View 1 Replies View Related

Required Free EBook On Reporting Services 2005.

Sep 20, 2007

Hello Friends,

I am in need of eBook on Reporting Services 2005 for study perpose, Please guide me through any link.







Thanks,
Vishal.

View 5 Replies View Related

What Kind Permission Required To Access Sys.sysreferences On SQL 2005?

Jul 20, 2006

In SQL 2000, a guest user can access any system tables in a database, but it looks not the same in SQL 2005. What even worse is the SQL security handles it in a confused way. When I sign on as sa and run:

SELECT * FROM sys.sysreferences

Of course I get what I want. While, if I sign on as a user only has guest privilege, I get nothing. Based on my understanding, if one does not have permission to SELECT, he should get rejucted error message. Otherwise, he should get return data. Now, SQL 2005 does not give any.

More interesting thing is when select * from sys.sysobjects, SQL 2005 return data to both sa user and user with guest privilege. Did MS applied different security on different sys.sys.. table? When a select return nothing, how can we know if there is no data at all, or the user does not have sufficient privilege.

Please help me to get out this puzzle.

Thanks.

View 1 Replies View Related

Minimum Permissions Required By The SQL Server 2005 Upgrade Advisor

Feb 15, 2008

Hi all,

What are the minimum permissions required by the SQL Server 2005 Upgrade Advisor (UA)? I could not find it in the documentation.

Obviously being a local Administrators Windows group and a member of sysadmin SQL Server role will do the trick.

But will being a member of only the sysadmin SQL Server role be enough? I know that the UA does want to read the registry.

Running it under just sysadmin generates the following type of errors:










Database Server
PreUpgrade
Requested registry access is not allowed.
WINSOCKPROXY

Database Server
PreUpgrade
Requested registry access is not allowed.
FTUNSIGNEDCOMPONENTS

Database Server
PreUpgrade
Requested registry access is not allowed.
NETPROTOCOL

Database Server
PreUpgrade
Requested registry access is not allowed.
FTMULTIPLEINSTANCES

Database Server
PreUpgrade
Requested registry access is not allowed.
INVALIDNAMEDPIPE

Database Server
PreUpgrade
Requested registry access is not allowed.
FTCOMPONENTREG

Database Server
PreUpgrade
Requested registry access is not allowed.
FTACCTPASS


The issue then is whether these are significant or not. If the UA is only reading the registry to determine if SSAS, DTS, etc is installed then that is not important. But if it is affecting the end result because it cannot read critical information from the registry that is another matter.

TIA

View 1 Replies View Related

Insert In SQL Server C# Code

Feb 7, 2005

When someone clicks my form
i use this code to enter data in Server:

private void Submit_Click(object sender, System.EventArgs e)
{
SqlConnection con = null;
SqlCommand cmd = null;
SqlDataReader rd = null;

try
{
con = new SqlConnection("server=localhost; uid=sa; pwd=123; database=TaskManagement");
cmd = new SqlCommand("INSERT INTO TASK_TYPE (name) VALUES ("+name.Text+")", con);

con.Open();
rd = cmd.ExecuteQuery();


}
catch (Exception e)
{
Response.Write("<p><font color="red">Error: ");
Response.Write(e.Message);
Response.Write("</font></p>");
}
finally
{
if(rd != null)
rd.Close();
if(con != null)
con.Close();
}
}


is that right? I am new in c# and i try to make it work!
Thanks in advance!

View 2 Replies View Related

Insert Country Code Into Columns

Nov 9, 2011

I am having a users table which contains "Mobile" column as well. I want a query to set the country code value by default into the column name so that the column should be updated with the mobile number along with the default country code.

View 10 Replies View Related

Optimization Of Unpivot / Insert Code

Sep 11, 2015

Trying to optimise the below query, I believe it's do with the estimated rows on the unpivot using Supratimes this seems to be the only sticking point.The query below is an example replicating what I'm trying to do in live, it takes around 2 seconds to run on my pc.

Create --drop --alter
Table #Actuals
(
Period1 FLOAT
, Period2 FLOAT
, Period3 FLOAT
, Period4 FLOAT

[code]....

View 8 Replies View Related

UPDATE INSERT Code Efficiency

Sep 17, 2005

Not sure what happened to my post, it seems to have disappeared. Here we go again. I have a stored procedure that I would like some feedback on, as I feel it may be inefficient as coded:

@ZUserID varchar(10)
AS
SET NOCOUNT ON

DECLARE @counter int
SET @counter = 0
WHILE @counter < 10
BEGIN
SET @counter = @counter + 1
IF EXISTS(SELECT * FROM tblWork WHERE UserID = @ZUserID And LineNumber = @counter)
BEGIN
UPDATE tblWork SET
TransID = Null,
TransCd = Null,
InvoiceNo = Null,
DatePaid = Null,
Adjustment = Null,
Vendor = Null,
USExchRate = Null
WHERE
UserID = @ZUserID And LineNumber = @counter
END
ELSE
INSERT INTO tblWork
(LineNumber,TransCd,UserID)
VALUES
(@counter,'P',@ZUserID)
END

View 2 Replies View Related

Insert HTMl Code In Database

Feb 23, 2008

Hello,

I am creating an ASP.NET web site which inserts data in a SQL database using LINQ.

One table column will hold HTML code. I am using a simple TextBox to input the data.

I would like to create my text in my computer and then copy/paste the HTML code to my TextBox and insert in the database.

What software should I use to create my text? Microsoft Office 2007, ... ? Any suggestion would be great.

Can I do it this way?

Thanks,

Miguel

View 9 Replies View Related

Installing SQL 2005 In An Existing W2k3 Cluster - Is Domain Admin Rights Required?

Apr 17, 2008

I have DBA that is convinced that they need domain admin rights to install SQL 2005 into an existing cluster. The domain groups and service accounts for SQL have been created already. Is having domain admin rights required during the install of SQL 2005 in a cluster?

View 1 Replies View Related

Setup Failed To Install Required Microsoft SQL Server 2005 Express (MSSMLBIZ)

Aug 23, 2007

I have tried to install Outlook 2007 with BCM and recieve the error listed above. I have also included a copy of my log file. Any suggestions?

Microsoft SQL Server 2005 9.00.2047.00
==============================
OS Version : Microsoft Windows XP Professional Service Pack 2 (Build 2600)
Time : Thu Aug 23 14:22:59 2007

Machine : MACBOOK
Product : Microsoft SQL Server Setup Support Files (English)
Product Version : 9.00.2047.00
Install : Successful
Log File : C:Program FilesMicrosoft SQL Server90Setup BootstrapLOGFilesSQLSetup0010_MACBOOK_SQLSupport_1.log
--------------------------------------------------------------------------------
Machine : MACBOOK
Product : Microsoft SQL Server Native Client
Product Version : 9.00.2047.00
Install : Successful
Log File : C:Program FilesMicrosoft SQL Server90Setup BootstrapLOGFilesSQLSetup0010_MACBOOK_SQLNCLI_1.log
--------------------------------------------------------------------------------
Machine : MACBOOK
Product : Microsoft SQL Server VSS Writer
Product Version : 9.00.2047.00
Install : Successful
Log File : C:Program FilesMicrosoft SQL Server90Setup BootstrapLOGFilesSQLSetup0010_MACBOOK_SqlWriter_1.log
--------------------------------------------------------------------------------
Machine : MACBOOK
Product : MSXML 6.0 Parser
Product Version : 6.00.3883.8
Install : Failed
Log File : C:Program FilesMicrosoft SQL Server90Setup BootstrapLOGFilesSQLSetup0010_MACBOOK_MSXML6_1.log
Error Number : 1603
--------------------------------------------------------------------------------
SQL Server Setup failed. For more information, review the Setup log file in %ProgramFiles%Microsoft SQL Server90Setup BootstrapLOGSummary.txt.

Time : Thu Aug 23 14:23:45 2007

List of log files:
C:Program FilesMicrosoft SQL Server90Setup BootstrapLOGFilesSQLSetup0010_MACBOOK_Core(Local).log
C:Program FilesMicrosoft SQL Server90Setup BootstrapLOGFilesSQLSetup0010_MACBOOK_SQLSupport_1.log
C:Program FilesMicrosoft SQL Server90Setup BootstrapLOGFilesSQLSetup0010_MACBOOK_SQLNCLI_1.log
C:Program FilesMicrosoft SQL Server90Setup BootstrapLOGFilesSQLSetup0010_MACBOOK_SqlWriter_1.log
C:Program FilesMicrosoft SQL Server90Setup BootstrapLOGFilesSQLSetup0010_MACBOOK_MSXML6_1.log
C:Program FilesMicrosoft SQL Server90Setup BootstrapLOGFilesSQLSetup0010_MACBOOK_Datastore.xml
C:Program FilesMicrosoft SQL Server90Setup BootstrapLOGFilesSQLSetup0010_MACBOOK_.NET Framework 2.0.log
C:Program FilesMicrosoft SQL Server90Setup BootstrapLOGFilesSQLSetup0010_MACBOOK_SNAC.log
C:Program FilesMicrosoft SQL Server90Setup BootstrapLOGFilesSQLSetup0010_MACBOOK_Core.log
C:Program FilesMicrosoft SQL Server90Setup BootstrapLOGSummary.txt
C:Program FilesMicrosoft SQL Server90Setup BootstrapLOGFilesSQLSetup0010_MACBOOK_Support.log
C:Program FilesMicrosoft SQL Server90Setup BootstrapLOGFilesSQLSetup0010_MACBOOK_SCC.log

View 3 Replies View Related

Setup Failed To Install The Required Component Microsoft SQL Server 2005 Express (MSSMLBIZ)

Jul 4, 2007

I Don't understand what this means: Everytime I try and install the disc 2 of my Office Small Business 2007, it gives the same message. Help.




Microsoft SQL Server 2005 9.00.3042.00
==============================
OS Version : Home Edition (Build 6000)
Time : Tue Jul 03 17:14:45 2007

Machine : SWANNER-PC
Product : Microsoft SQL Server Setup Support Files (English)
Product Version : 9.00.3042.00
Install : Failed
Log File : c:Program FilesMicrosoft SQL Server90Setup BootstrapLOGFilesSQLSetup0005_SWANNER-PC_SQLSupport_1.log
Error Number : 1618
--------------------------------------------------------------------------------
Machine : SWANNER-PC
Product : Microsoft SQL Server Native Client
Product Version : 9.00.3042.00
Install : Failed
Log File : c:Program FilesMicrosoft SQL Server90Setup BootstrapLOGFilesSQLSetup0005_SWANNER-PC_SQLNCLI_1.log
Error Number : 1618
--------------------------------------------------------------------------------
Machine : SWANNER-PC
Product : Microsoft SQL Server VSS Writer
Product Version : 9.00.3042.00
Install : Failed
Log File : c:Program FilesMicrosoft SQL Server90Setup BootstrapLOGFilesSQLSetup0005_SWANNER-PC_SqlWriter_1.log
Error Number : 1618
--------------------------------------------------------------------------------

SQL Server Setup failed. For more information, review the Setup log file in %ProgramFiles%Microsoft SQL Server90Setup BootstrapLOGSummary.txt.


Time : Tue Jul 03 17:15:12 2007


List of log files:
c:Program FilesMicrosoft SQL Server90Setup BootstrapLOGFilesSQLSetup0005_SWANNER-PC_Core(Patched).log
c:Program FilesMicrosoft SQL Server90Setup BootstrapLOGFilesSQLSetup0005_SWANNER-PC_SQLSupport_1.log
c:Program FilesMicrosoft SQL Server90Setup BootstrapLOGFilesSQLSetup0005_SWANNER-PC_SQLNCLI_1.log
c:Program FilesMicrosoft SQL Server90Setup BootstrapLOGFilesSQLSetup0005_SWANNER-PC_SqlWriter_1.log
c:Program FilesMicrosoft SQL Server90Setup BootstrapLOGFilesSQLSetup0005_SWANNER-PC_Datastore.xml
c:Program FilesMicrosoft SQL Server90Setup BootstrapLOGFilesSQLSetup0005_SWANNER-PC_.NET Framework 2.0.log
c:Program FilesMicrosoft SQL Server90Setup BootstrapLOGFilesSQLSetup0005_SWANNER-PC_Support.log
c:Program FilesMicrosoft SQL Server90Setup BootstrapLOGFilesSQLSetup0005_SWANNER-PC_Core.log
c:Program FilesMicrosoft SQL Server90Setup BootstrapLOGSummary.txt
c:Program FilesMicrosoft SQL Server90Setup BootstrapLOGFilesSQLSetup0005_SWANNER-PC_SCC.log

View 38 Replies View Related

Retreive Html Code From Xmlfile, Insert Into Table

Nov 15, 2007

I use the following query to shred an xml and insert it into a table, but I want to have the whole html structure into the column to be able to present the formatted text in Cognos 8 BI.

WITH xmlnamespaces('http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-01-15T13:29:33' AS my)
INSERT INTO TMP_ATGFORSLAG (AtgForslagDesc)
SELECT
AtgForslagRad.value('(/my:AtgForslagRad/my:AtgForslagDesc)[1]', 'varchar(2000)') AS AtgForslagDesc
FROM dbo.DeklAtgForslagXml

The structure of the source in the xmlfile I want to import is:
<my:AtgForslagDesc>
<html xmlns="http://www.w3.org/1999/xhtml">
<ol>
<li>Text1...</li>
<li>Text2...</li>
<li>Text3...</li>
</ol>
</html>
</my:AtgForslagDesc>

How do I shred not only the text but the whole starting <html> to finishing </html> and insert it into a table I would be very happy.

View 1 Replies View Related

Cannot Open SQL Server 2005 Express From C#.Net 2005 (using Code)

Mar 15, 2008


can anybody help me.

I am getting an sql Server 2005 connection error from c#.net 2005.

following is the 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)"}

---------------------------------------------------------------------------------------------


i have changed the default settings. local and remote connection are enabled.

following are the code i am using in C# .Net 2005
---------------------------------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;


SqlConnection conn = new SqlConnection("server=localhost; user id= sa; pwd =; Initial Catalog=testdb;");

---------------------------------------------------------------------------------------------------------------


when i connect through the c# wizard, everything is perfect.

thanks in advance
sam alex

View 10 Replies View Related

SQL Server Insert Update Stored Procedure - Does Not Work The Same Way From Code Behind

Mar 13, 2007

All:
 I have created a stored procedure on SQL server that does an Insert else Update to a table. The SP starts be doing "IF NOT EXISTS" check at the top to determine if it should be an insert or an update.
When i run the stored procedure directly on SQL server (Query Analyzer) it works fine. It updates when I pass in an existing ID#, and does an insert when I pass in a NULL to the ID#.
When i run the exact same logic from my aspx.vb code it keeps inserting the data everytime! I have debugged the code several times and all the parameters are getting passed in as they should be? Can anyone help, or have any ideas what could be happening?
Here is the basic shell of my SP:
CREATE PROCEDURE [dbo].[spHeader_InsertUpdate]
@FID  int = null OUTPUT,@FLD1 varchar(50),@FLD2 smalldatetime,@FLD3 smalldatetime,@FLD4 smalldatetime
AS
Declare @rtncode int
IF NOT EXISTS(select * from HeaderTable where FormID=@FID)
 Begin  begin transaction
   --Insert record   Insert into HeaderTable (FLD1, FLD2, FLD3, FLD4)    Values (@FLD1, @FLD2, @FLD3,@FLD4)   SET @FID = SCOPE_IDENTITY();      --Check for error   if @@error <> 0    begin     rollback transaction     select @rtncode = 0     return @rtncode    end   else    begin     commit transaction     select @rtncode = 1     return @rtncode    end      endELSE
 Begin  begin transaction
   --Update record   Update HeaderTable SET FLD2=@FLD2, FLD3=@FLD3, FLD4=@FLD4    where FormID=@FID;
   --Check for error   if @@error <> 0    begin     rollback transaction     select @rtncode = 0     return @rtncode    end   else    begin     commit transaction     select @rtncode = 2     return @rtncode   end
End---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 
 Thanks,
Blue.

View 5 Replies View Related

Required Microsoft Sql Server 2005 Express Server Roles For JDBC Connection

Mar 28, 2007

Hi!

I have developed a database in MS SQL Server 2005 Express, to which I would require only bulkadmin server role from an external java application, because I only need to update rows, insert values or use select queries in the database.

The problem is that, using either the Microsoft JDBC Driver 1.1 or the Java JDBC ODBC Driver and the Windows XP Data Base (ODBC) configurations, I need a user with sysadmin server role inside Sql Server, otherwise JDBC won't connect to the database using the selected user. Even if I leave the sql login with setupadmin or any server role lower than sysadmin, the connection is refused.

Is there no way to connect using JDBC to MS Sql Server 2005 other than granting the connected user sysadmin rights? My code looks as follows:




Code Snippet

String driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
String url = "jdbc:sqlserver://FIREBLADE\SQLEXPRESS";
String user = "username";
String password = "password$$";
Connection conn;

Class.forName(driver);
conn = DriverManager.getConnection(url,user,password);
if (conn != null)
System.out.println("SQL Server Connection established ...");

I have heard that Java JDBC connections to Microsoft require high-level access.

Any informed answer is more than welcome. Thanks for reading my post!

View 1 Replies View Related

Transact Sql 2005 Code Changes

Aug 28, 2006

Have there been any updates to sql 2005 transact codes, because I tried to use some transact code that I used in sql 8.0 and in sql 2005 on the same database and it did not work.

Here is the code I used



Select p.pub_name,
e.fname + ' ' + e.lname "Employee name",
e.job_lvl


from publishers P inner join employee e on p.pub_id = e.pub_id
where e.job_lvl > 200



View 1 Replies View Related

Sql Server 2000 Required But Only Have SQL Server 2005

May 8, 2006

I have recently purchased SQL server 2005 for a new install of bespoke software - I have however just been told that it only runs on SQL server 2000 at the moment - is there a way I can install sql 2000 server from the 2005 cd? any help would be greatly appreciated.



thanks

View 4 Replies View Related







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