What Am I Doing Wrong? I Just Want To Modify My Database From A Webform.
Feb 20, 2006
Windows XP
SQL Expresss 2005
SQL Express 2005 Manager
I simply want to edit and data I have in a database that I made with Express Manager. This worked before .Net 2.0. Now, I have the table displayed as a datagrid with an "edit" pushbutton associated with each row in the database table. When I click on the "edit" pushbutton to edit a specific row in the database table, instead of posting me to a page where the chosen row is editable, I am posted back to the same page without the chosen row availible to be edited.
What am I doing wrong? How can I fix this? I am totally new to this so any help would be appreciated.
Cheers!
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="iso-8859-1" EnableEventValidation="false" %>
<%@ Register TagPrefix="MM" Namespace="DreamweaverCtrls" Assembly="DreamweaverCtrls,version=1.0.0.0,publicKeyToken=836f606ede05d46a,culture=neutral" %>
<MM:DataSet
id="dsParts"
runat="Server"
IsStoredProcedure="false"
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_STRING_PartsAreUs"] %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_DATABASETYPE_PartsAreUs"] %>'
CommandText='<%# "SELECT * FROM dbo.Parts" %>'
Debug="true"
>
<EditOps>
<EditOpsTable Name="dbo.Parts" />
<Parameter Name="Name" Type="VarChar" />
<Parameter Name="Description" Type="NVarChar" />
<Parameter Name="Price" Type="Money" />
<Parameter Name="PartID" Type="Int" IsPrimary="true" />
</EditOps>
</MM:DataSet>
<MM:PageBind runat="server" PostBackBind="true" />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<form runat="server">
<asp:DataGrid id="dgParts"
runat="server"
AllowSorting="False"
AutoGenerateColumns="false"
CellPadding="3"
CellSpacing="0"
ShowFooter="false"
ShowHeader="true"
DataSource="<%# dsParts.DefaultView %>"
PagerStyle-Mode="NextPrev"
DataKeyField="PartID"
onCancelCommand="dsParts.OnDataGridCancel"
onEditCommand="dsParts.OnDataGridEdit"
onUpdateCommand="dsParts.OnDataGridUpdate"
onItemDataBound="dsParts.OnDataGridItemDataBound"
>
<HeaderStyle HorizontalAlign="center" BackColor="#E8EBFD" ForeColor="#3D3DB6" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Bold="true" Font-Size="smaller" />
<ItemStyle BackColor="#F2F2F2" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Size="smaller" />
<AlternatingItemStyle BackColor="#E5E5E5" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Size="smaller" />
<FooterStyle HorizontalAlign="center" BackColor="#E8EBFD" ForeColor="#3D3DB6" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Bold="true" Font-Size="smaller" />
<PagerStyle BackColor="white" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Size="smaller" />
<Columns>
<asp:EditCommandColumn
ButtonType="PushButton"
CancelText="Cancel"
EditText="Edit"
HeaderText="Edit"
UpdateText="Update"
Visible="True"/>
<asp:BoundColumn DataField="PartID"
HeaderText="PartID"
ReadOnly="true"
Visible="True"/>
<asp:BoundColumn DataField="Name"
HeaderText="Name"
ReadOnly="false"
Visible="True"/>
<asp:BoundColumn DataField="Description"
HeaderText="Description"
ReadOnly="false"
Visible="True"/>
<asp:BoundColumn DataField="Price"
HeaderText="Price"
ReadOnly="false"
Visible="True"/>
</Columns>
</asp:DataGrid>
</form>
</body>
</html>
View 3 Replies
ADVERTISEMENT
Apr 9, 2008
Hello, I am writing a website (in vb) to allow for room use reservations and I am looking for a way to compare the selected start and end times which are date-time format to records already in the database for that day/time and specific room. If the selected time does not fall within an already reserved time frame I then want to insert it into the table. I have already written a procedure to do the inserting and that works fine. I just want to validate it before calling the insert. Any ideas? The fields to be validated on the form are textboxes containing date time which populate as read only after the time selection is chosen from dropdown. Thanks in advance It's greatly appreciated.
View 7 Replies
View Related
Feb 27, 2008
Hi,I m using vwd2005 and sql express,c#.I have a question here.In my database i have a table named Table1(id,name,age,country,email,phone) The values for these fields are inserted from the webform.Id is auto generated.name and age is passed from the textbox within the webform.country is passed from dropdownlist within the webform.email and phone is passed from listbox(multiple email and phone) within the webform.Now my problem is i want to retrieve all these row values back into the textboxes,dropdownlist and listbox at the same timeon the click of the retrieve button within the web form . Further more i want to make few changes on it and update the database on the click of another button update within the form.I hope u are getting it.How would the query would be in this case.?can u demonstrate the concept in one simple running example along with code?thanks.jack.
View 3 Replies
View Related
Mar 25, 2008
Hello Everyone,I 've trying to retreive data back into webform from the database from past couple of weeks.But i m not able to retrieve it completely.Here is my scenario.I've tried to explain in detail but in simple language.I hope u will get my point.Ok here it is.plz run my code:-i have three tables in sql.they are:-grup(id,grp) (1,abc) (2,xyz) organization(id,oid,gid,organisation,orgphone) (1,1,1,ibm,1234567) (2,1,2,microsoft,6543210) (3,2,1,oracle,7654323) (4,2,2,apple,9876543) userform(id,title,name,address,email,organizationid) (1,mr,jack,usa,jack@jack.com,1) userform.aspx page<%@ Page Language="C#" AutoEventWireup="true" CodeFile="userform.aspx.cs" Inherits="userform" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <div> <div style="text-align: center"> <table> <tr> <td style="width: 100px"> Title</td> <td style="width: 100px"> <asp:DropDownList ID="DropDownList1" runat="server"> <asp:ListItem>mr</asp:ListItem> <asp:ListItem>miss</asp:ListItem> <asp:ListItem>ms</asp:ListItem> </asp:DropDownList></td> </tr> <tr> <td style="width: 100px"> Name</td> <td style="width: 100px"> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></td> </tr> <tr> <td style="width: 100px"> Add</td> <td style="width: 100px"> <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox></td> </tr> <tr> <td style="width: 100px; height: 26px;"> Email</td> <td style="width: 100px; height: 26px;"> <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox></td> </tr> </table> </div> </div> <div style="text-align: center"> <div> <div> <asp:ScriptManager ID="ScripManager1" runat="server"> </asp:ScriptManager> <div> <table> <tr> <td style="width: 100px"> Group</td> <td style="width: 100px">
<asp:DropDownList ID="ddl1" runat="server" AutoPostBack="true"
OnSelectedIndexChanged="ddl1_SelectedIndexChanged"> </asp:DropDownList></td> </tr> </table> </div> <div> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <table> <tr> <td> Organisation </td> <td>
<asp:DropDownList ID="ddl2" runat="server" AutoPostBack="true"
OnSelectedIndexChanged="ddl2_SelectedIndexChanged"> </asp:DropDownList> </td> </tr> <tr> <td> org-phone </td> <td> <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox> </td> </tr> <tr> <td> </td> <td>
<asp:TextBox ID="TextBox5" runat="server"
Width="45px"></asp:TextBox></td> </tr> </table> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="ddl1" EventName="SelectedIndexChanged" /> </Triggers> </asp:UpdatePanel> <br /> <table> <tr> <td style="width: 100px"> <asp:Button ID="Button1" runat="server" Text="save" OnClick="Button1_Click" /> </td> <td style="width: 100px"> <asp:Button ID="Button3" runat="server" Text="update" /></td> <td style="width: 100px"> <asp:Button ID="Button2" runat="server" Text="cancel" /></td> </tr> </table> </div> </div> </div> </div> </form></body></html>userform.cs page public partial class userform : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { AssignDDLDataSource(); ddl1_SelectedIndexChanged(null, null); } } private void AssignDDLDataSource() { // SqlConnection string sqlQry = "SELECT GRP DISPMEM, ID VALMEM FROM GRUP"; SqlCommand cmd = new SqlCommand(sqlQry, con); ddl1.DataSource = cmd.ExecuteReader(); ddl1.DataTextField = "DISPMEM"; ddl1.DataValueField = "VALMEM"; ddl1.DataBind(); } protected void ddl1_SelectedIndexChanged(object sender, EventArgs e) { AssignSubjectDDL(ddl1.SelectedValue); } private void AssignSubjectDDL(string val) { // SqlConnection string sqlQry = "SELECT ORGANISATION DISPMEM, GID VALMEM FROM ORGANIZATION where OID = '" + val + "'"; SqlCommand cmd1 = new SqlCommand(sqlQry, con); ddl2.DataSource = cmd1.ExecuteReader(); ddl2.DataTextField = "DISPMEM"; ddl2.DataValueField = "VALMEM"; ddl2.DataBind(); ddl2_SelectedIndexChanged(null, null); } protected void ddl2_SelectedIndexChanged(object sender, EventArgs e) { AssignTextBoxValues(ddl1.SelectedValue, ddl2.SelectedValue); } private void AssignTextBoxValues(string teamval, string memval) { // SqlConnection
string sqlQry = "Select ID,ORGANISATION,ORGPHONE from ORGANIZATION
where OID = '" + teamval + "' AND GID = '" + memval + "'"; SqlCommand cmd = new SqlCommand(sqlQry, con); SqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { TextBox5.Text = rdr["ID"].ToString().Trim(); TextBox4.Text = rdr["ORGPHONE"].ToString().Trim(); } } protected void Button1_Click(object sender, EventArgs e) { // SqlConnection
string sqlQry = "INSERT into USERFORM (title, name, address, email,
organizationid) VALUES(@title,@name,@address,@email,@organizationid)"; SqlCommand cmd = new SqlCommand(sqlQry, con); cmd.CommandType = CommandType.Text; cmd.Parameters.AddWithValue("title", DropDownList1.SelectedValue.Trim()); cmd.Parameters.AddWithValue("name", TextBox1.Text); cmd.Parameters.AddWithValue("address", TextBox2.Text); cmd.Parameters.AddWithValue("email", TextBox3.Text); cmd.Parameters.AddWithValue("organizationid", TextBox5.Text); cmd.ExecuteNonQuery(); Response.Redirect("detailsview.aspx"); }} detailsview.aspx <%@ Page Language="C#" AutoEventWireup="true" CodeFile="detailsview.aspx.cs" Inherits="detailsview" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <div> <asp:DetailsView ID="DetailsView1" runat="server" AllowPaging="True" EnablePagingCallbacks="True" Height="50px" HorizontalAlign="Center" Width="125px"> </asp:DetailsView> </div> </form></body></html> detailsview.cspublic partial class detailsview : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { //SqlConnection
string str = "select title,name,address,email,grp,organisation,orgphone
from userform as a inner join organization as b on
a.organizationid=b.id inner join grup as c on b.oid=c.id"; SqlDataAdapter oda = new SqlDataAdapter(str, conn); conn.Open(); DataSet ods = new DataSet(); oda.Fill(ods, "info"); DetailsView1.DataSource = ods.Tables["info"].DefaultView; DetailsView1.DataBind(); }}My problem :-Now when user fills up the userform and clicks the save button the details are shown in the details view.Now i want to add a Edit hyperlink next to the records in the detailsview so that when i click on it i would be redirected to userform.aspx form with all the textboxes,dropdownlist etc be populated from the related data from the database.(here table userform).Now i want to edit these data in the userform.aspx page and finally when i click the update button at end i want all the data be updated in the database aswell as in details view too.at the same time i want this form to redirect to detailsview.aspx .i hope ur getting it?i m able to do partial part only.Not completely. So can u now help me modify the code accordingly?Thanks in advance.Jack.
View 4 Replies
View Related
May 14, 2007
Hi, all experts here,
Thank you very much for your kind attention.
I am trying to modify the files path (primary file, log file) of databases, but it looks like I am not able to mofidy their files path directly from the database property dialogue? Would please any experts here give me some ideas on what else can I try to figure it out? Thanks a lot in advance and I am looking forward to hearing from you shortly.
With best regards,
Yours sincerely,
View 5 Replies
View Related
May 21, 2008
hi there,
After replicating a database, the stored procedures in that same database are not able to edit by other users than service account (sys admin users), When the normal users try to edit any of the stored procedures, sql server 2005 is throwing the following error...
Msg 21050, Level 16, State 1, Procedure sp_MSmerge_ddldispatcher, Line 12Only members of the sysadmin fixed server role or db_owner fixed database role can perform this operation. Contact an administrator with sufficient permissions to perform this operation.
any suggessions are most welcome.
by
CHINNASAMY
View 1 Replies
View Related
Jun 9, 2006
I'm having a problem retrieving information from two different tables. Everytime i run a query which i type a source id into a textbox my page keeps timing out. What could be the problem? The tables i'm pulling from is profiles and phone. Here is the code. If someone could tell me what's going on id apperciate it. Thanks!
Dim queryString As String = "SELECT [profiles].[date_added], [profiles].[source_id], [RP_profiles].[fnam"& _"e], [profiles].[lname], [profiles].[title], [phone].[number], [RP_phone"& _"].[source_id] FROM [profiles], [phone] WHERE ([profiles].[source_id] = "& _"@source_id)"
View 3 Replies
View Related
Aug 3, 2007
Can someone help with this? Let me know if what I'm trying to do is possible...
Here's code example:
@ClientID int,
@QuoteID int,
@Base real,
@One real,
@DwellingLimit real
AS
BEGIN
Insert Into tblOne(ClientID,QuoteID,GuideID,GuideRate,GuideMult,Premium)
Select @ClientID, @QuoteID, GuideID,GuideRate, @+"GuideMult"+,GuideRate*GuideMult
From tblTwo
Where Choose = 'True';
END
I need the value stored in tblTwo.GuideMult (ie. One, BaseRate) to be translated
into the numerical value shown on a webform (ie. @One, @BaseRate) and then
insert the numerical values into tblOne.GuideMult
Clear as mud? Does somebody have a better way to do this?
View 1 Replies
View Related
Dec 4, 2003
Hi,
On Administrator session, I have created an CUSTOMER MSDE database. That's OK.
On user session, I want to access on my database CUSTOMER but I have on error : "Unable to connect to the database". And, in French : "Echec de la connexion de l'utilisateur Machine_Name/User_Name".
What is the error ? I don't know what to do any more.
How to give right to the user ? Have you an idea ?
Thank's.
Patrice A. BONNEFOY.
View 2 Replies
View Related
Mar 1, 2006
I have replaced the installation of MSDE 1.0 with MSDE 2000.
Prior to installation of MSDE 2000, I can perform the activities of all
database role. Now, I can only add, change and delete data - no
more database design.
What should I do to regain database design permission?
I'm using "sa" user with blank password when I login to MS Access Project.
View 5 Replies
View Related
Jan 20, 2008
Hello, I have gone to work for a new company and I have seen this company is running out of drive space on a daily basis. The DBA before me created huge databases. For example we have a database that it's created size is 103 GB. Only about 52 GB is ever needed. I know you can resize the tempdb but how about user databases? I have never tried this. Can this be done for a user database?
For tempdb
Start SQL from cmd line sqlserver -c -f -s%instance_name%
alter databse tempdb modify file
(name='tempdev',size=150)
View 3 Replies
View Related
Oct 4, 2007
I have 30+ databases in sql 2000.
I want to dynalically loop though each of the databases and alter a column named 'EmpName' for all the 'Employees' tables in that database.
Here is my attempt.use Master
go
declare @SQLString Nvarchar(1000)
declare @DBName Nvarchar(100)
declare @SQL2 NVARCHAR(1000)declare @TABLE_NAME NVarchar(100)
DECLARE curDB CURSOR LOCAL FORWARD_ONLY STATIC FOR
SELECT name FROM sysdatabases
OPEN curDB
FETCH NEXT FROM curDB INTO @dbname
While @@FETCH_STATUS=0
Begin
SET @SQL2 = 'USE ' + @DBNAME + ' ALTER TABLE ' + @TABLE_NAME + ' MODIFY EmpName varchar(100)'
from information_schema.tables where table_type = 'BASE TABLE' and table_name like '%Employees%' PRINT @SQL2
EXECUTE SP_EXECUTESQL @SQL2
fetch next from curDB into @DBName
end
Close curDB
End
When i execute the above script in master, it says 'Query executed successfully' but when i see the all the Employees table in each of the database, the required change is not made.
Can anybody explain this or give an alternate solution?
View 2 Replies
View Related
Mar 30, 2007
Hello all,
I am having problems running a stored proc from an aspx.cs file. Basically I want to extract data from webForm controls and create a new record in a DB table. I have watched the "Getting Started" videos on thi site, and the only difference between my code and the code of the demonstrator is the connection string. My conn string:- dataSrc.ConnectionString = ConfigurationManager.ConnectionStrings["ProjectTblConnString"].ConnectionString;Demonstrator conn string:- dataSrc.ConnectionString = ConfigurationManager.ConnectionStrings("ProjectTblConnString");When I debug with the string as shown by the demonstrator the error list reports that ConnectionStrings is a property and I am trying to use it as a mothod, which is fair enough, but I am just confused as how it worked for the demonstrator and not myself. When I debug with the code I used above I get no error, but nothing is inserted in the DB.Also, it looks as if the only class in my aspx.cs file that is actually being executed is PageLoad() - the remainder of the code seems to be ignored. Below is the entired aspx.cs file:- 1 using System;
2 using System.Data;
3 using System.Configuration;
4 using System.Collections;
5 using System.Web;
6 using System.Web.Security;
7 using System.Web.UI;
8 using System.Web.UI.WebControls;
9 using System.Web.UI.WebControls.WebParts;
10 using System.Web.UI.HtmlControls;
11
12 public partial class CreateProject : System.Web.UI.Page
13 {
14 protected void Page_Load(object sender, EventArgs e)
15 {
16
17 if (User.Identity.IsAuthenticated == false)
18 {
19 Server.Transfer("Default.aspx");
20 }
21
22 if (chkbox_startDate.Checked == true)
23 {
24 txtbox_startDate.ReadOnly = true;
25 txtbox_startDate.Text = (System.DateTime.Now.ToString());
26 }
27
28 }
29
30 protected void btn_create_Click(object sender, EventArgs e)
31 {
32 //connection string for connecting to SQL Server DB
33 SqlDataSource dataSrc = new SqlDataSource();
34 dataSrc.ConnectionString = ConfigurationManager.ConnectionStrings["ProjectTblConnString"].ConnectionString;
35
36
37 //insert data in table using the CreateNewProject stored proc in the DB
38 dataSrc.InsertCommandType = SqlDataSourceCommandType.StoredProcedure;
39 dataSrc.InsertCommand = "CreateNewProject";
40 dataSrc.InsertParameters.Add("Project_Title", txtbox_title.ToString() );
41 dataSrc.InsertParameters.Add("Description", txtbox_desc.ToString() );
42 dataSrc.InsertParameters.Add("Start_Date", txtbox_startDate.ToString() );
43 dataSrc.InsertParameters.Add("Primary_Dev_Lang", list_devLang.ToString() );
44 dataSrc.InsertParameters.Add("Dev_Environment", list_devEnv.ToString() );
45 dataSrc.InsertParameters.Add("No_Junior_Devs", txtbox_juniorDevs.ToString() );
46 dataSrc.InsertParameters.Add("No_Senior_Devs", txtbox_seniorDevs.ToString() );
47
48 int rowsAffected = 0;
49 try
50 {
51 rowsAffected = dataSrc.Insert();
52 }
53 catch (Exception ex)
54 {
55 Server.Transfer(Error.aspx);
56 }
57 finally
58 {
59 dataSrc = null;
60 }
61
62 if (rowsAffected != 1)
63 {
64 label_confirm.Text = "Error, Contact system admin";
65 }
66 else
67 {
68 label_confirm.Text = "Success";
69 }
70
71 }//end btn_create
72
73 //if cancel is clicked set all values back to default
74 protected void btn_cancel_Click(object sender, EventArgs e)
75 {
76 txtbox_title.Text = "";
77 txtbox_desc.Text = "";
78 txtbox_startDate.Text = "";
79 txtbox_seniorDevs.Text = "";
80 txtbox_juniorDevs.Text = "";
81 list_devEnv.SelectedIndex = 0;
82 list_devLang.SelectedIndex = 0;
83 chkbox_startDate.Checked = true;
84 label_confirm.Text = "";
85 }
86
87 //if checked the current dateTime is inserted into txtbox
88 protected void chkbox_startDate_CheckedChanged(object sender, EventArgs e)
89 {
90 if (chkbox_startDate.Checked == true)
91 {
92 txtbox_startDate.ReadOnly = true;
93 txtbox_startDate.Text = (System.DateTime.Now.ToString());
94 }
95 else
96 {
97 txtbox_startDate.ReadOnly = false;
98 txtbox_startDate.Text = "";
99 }
100 }//end chkox
101
102
103 }//end class
Any help anyome can give is greatly appreciated. This is part of my Final Year College Dissertation which is due in 3wks !!!!
Sláinte á chaire,
Seán
View 2 Replies
View Related
Oct 21, 2007
HiI 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?ThanksEd
View 1 Replies
View Related
Nov 19, 2007
Hi,
I would like to know how to call a report from a report viewer control in a web application. The reporting services is forms authenticated. I've done this authentication using the sample solution given by microsoft (adding custom security extension). Now am able to view the reports from Report manager and Report server URL. But i dont know how to authenticate the user from my web application and pass the credentials to the report server to view the report in report viewer control. Can somebody help in this? its bit urgent. Thanks in advance
View 1 Replies
View Related
Jun 25, 2015
We are running into the following error while changing a column data type from nvarchar (1200) to varchar(8000)
"Msg 1105, Level 17, State 2, Line 1
Could not allocate space for object 'dbo.TBL1 '.'PK_CL_ID' in database 'Client01' because the 'PRIMARY' filegroup is full. Create disk space by deleting unneeded files, dropping objects in the filegroup, adding additional files to the filegroup, or setting autogrowth on for existing files in the filegroup.
The statement has been terminated."
Now tried to change the filegrowth of the log file to unlimited
ALTER DATABASE Client01
MODIFY FILE ( NAME = Client01_log, MAXSIZE = unlimited);
The query executes without error but I do not see the auto growth as unrestricted. It's still 2GB
View 6 Replies
View Related
Nov 6, 2015
I can run this command to make changes for 1 DB USE [master]
GO
ALTER DATABASE [DBName] MODIFY FILE ( NAME = N'Name_log', FILEGROWTH = 10000KB )
GO
Is it possible to create a script which changes log file size to let's say 100MB for all DBs in all servers instead of running the above command by logging into each server? We have about 200 servers and close to 3000 DBs.
View 2 Replies
View Related
May 6, 2015
I need reflecting changes of csv file in oracle DB. Suppose, I load single csv file in oracle DB which contains 10 rows. After some time, I have loaded another CSV file which has the modified row of the previously loaded csv file. So, how can I capture the CSV changes and how it is going to get reflected in oracle DB?There is no unique column in csv file to identify particular row.
View 3 Replies
View Related
Feb 19, 2006
Im trying to insert a record in my sql server 2005 express database.The following function tries that and without an error returns true.However, no data is inserted into the database...Im not sure whether my insert statement is correct: I saw other example with syntax: insert into table values(@value1,@value2)....so not sure about thatAlso, I havent defined the parameter type (eg varchar) but I reckoned that could not make the difference....Here's my code: Function CreateNewUser(ByVal UserName As String, ByVal Password As String, _ ByVal Email As String, ByVal Gender As Integer, _ ByVal FirstName As String, ByVal LastName As String, _ ByVal CellPhone As String, ByVal Street As String, _ ByVal StreetNumber As String, ByVal StreetAddon As String, _ ByVal Zipcode As String, ByVal City As String, _ ByVal Organization As String _ ) As Boolean 'returns true with success, false with failure Dim MyConnection As SqlConnection = GetConnection() Dim bResult As Boolean Dim MyCommand As New SqlCommand("INSERT INTO tblUsers(UserName,Password,Email,Gender,FirstName,LastName,CellPhone,Street,StreetNumber,StreetAddon,Zipcode,City,Organization) VALUES(@UserName,@Password,@Email,@Gender,@FirstName,@LastName,@CellPhone,@Street,@StreetNumber,@StreetAddon,@Zipcode,@City,@Organization)", MyConnection) MyCommand.Parameters.Add(New SqlParameter("@UserName", SqlDbType.NChar, UserName)) MyCommand.Parameters.Add(New SqlParameter("@Password", Password)) MyCommand.Parameters.Add(New SqlParameter("@Email", Email)) MyCommand.Parameters.Add(New SqlParameter("@Gender", Gender)) MyCommand.Parameters.Add(New SqlParameter("@FirstName", FirstName)) MyCommand.Parameters.Add(New SqlParameter("@LastName", LastName)) MyCommand.Parameters.Add(New SqlParameter("@CellPhone", CellPhone)) MyCommand.Parameters.Add(New SqlParameter("@Street", Street)) MyCommand.Parameters.Add(New SqlParameter("@StreetNumber", StreetNumber)) MyCommand.Parameters.Add(New SqlParameter("@StreetAddon", StreetAddon)) MyCommand.Parameters.Add(New SqlParameter("@Zipcode", Zipcode)) MyCommand.Parameters.Add(New SqlParameter("@City", City)) MyCommand.Parameters.Add(New SqlParameter("@Organization", Organization)) Try MyConnection.Open() MyCommand.ExecuteNonQuery() bResult = True Catch ex As Exception bResult = False Finally MyConnection.Close() End Try Return bResult End FunctionThanks!
View 1 Replies
View Related
Jan 2, 2003
Hi All,
Please help me with this problem. Hoping that someone might experienced and resolved it. I am setting up an SQL job. Job has few steps and one of the step runs a stored procedure. I am trying to select a database name (NYSP) from the pull down menu. I save that and when I open the job properties again and check the step it's selecting another database there (HIPAA) not the one I've selected. Anyone know why this happening?
Thanks a lot,
Jannat.
View 7 Replies
View Related
Dec 10, 2007
My db version is sqlserver2005 sp2
Now, I need to install report services
However failed when i specify the report server database after report services was installed
It prompt the database version(C.0.8.40) does not match the report services installation.You must update your reporting services installation.
but how to update reporting services installation?
Thanks a lot
View 2 Replies
View Related
Apr 19, 2006
I am using ASP.NET 1.1 and MS SQL 2005 the folowing ODBC stringconnection
Driver={SQL Server};Server=(local);MyBase;Uid=;Pwd=;Trusted_Co nnection=;
when trying to CREATE a TABLE (with vb.net code) I get an error because the TABLE are written in Master !! and not in MyBase
I am using windows Authentication
what can be wrong ?
thank you
View 6 Replies
View Related
Mar 16, 1999
My SQL Server question is that I have a database that is 800mb, a
logfile that is 150mb, but I have a database container that under SQL
says that it is -494mb (Negative 493mb).
Any ideas?, The program seems to work fine.
View 1 Replies
View Related
Apr 19, 2006
I am using ASP.NET and a normal ODBC stringconnectionDriver={SQL Server};Server=(local);MyBase;Uid=;Pwd=;Trusted_Co nnection=;when trying to CREATE a TABLE (with vb.net code) I get an error because the TABLE are written in Master !! and not in MyBasei am using windows authenticationwhat can be wrong ?thank you
View 13 Replies
View Related
Jun 9, 2015
I have a 50gb database, with 3 files at the primary filegroup, each one of those has around 16gb I truncated 2 tables releasing 33gb, so the database should have around 17gb now, but when I check at the properties it says that each file doesn't have any empty space
this is on a MSSQL 2012 SP2 CU1
View 6 Replies
View Related
Mar 6, 2008
I have set up mirroring in high availability mode (principal, mirror, and witness).
After setting up mirroring, I needed to adjust the size of a column in one of my tables. I did so with the following command
ALTER TABLE OrderOptimizer.dbo.rCodes ALTER COLUMN CodeDescription VARCHAR(8000).
The column was initially VARCHAR(128)
When I look at the table structure it shows that the column is now VARCHAR(8000), however I can only enter 128 characters into the field.
I forced a failover to look at the table on the mirrored version. It too showed that the column was VARCHAR(8000).
If I open the table I can enter more than 128 characters into the field, however when I refresh, it is truncated to 128 characters,
Any help would be appreciated
View 4 Replies
View Related
Mar 16, 2007
Hi am very new with VB.net (Visual Studio 2005) and the first time try to use the sql server 2005 express. I did create a trial.mdf (local server) and complete procedure to attach the trial1.mdf in Microsoft SQL Management Studio Express.
I try to use VB to connect /open/close it with the following codes: (but failed)
-----------------------------------------------
Imports System.Data.SqlClient
Public Class Form1
'Link database
Dim DB_Location = "c:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLDataTrial1.mdf"
Dim MyConnection = "Server=localhost; DataBase= " & DB_Location & "Integrated Security=SSPI"
Dim sqlConnection As New SqlConnection(MyConnection)
'Use database
Dim strSQL As String = "SELECT FROM Trial1 WHERE col2 = 'trial' "
Dim cmd As New SqlCommand(strSQL, MyConnection)
sqlConnection.Open() ' ----> error
cmd.ExecuteNonQuery() ' ----> error
sqlConnection.Close() ' ----> error
End Class
-------------------------------------------
At the last 3 line of codes I got the errors ... can someone explain why & help me to correct it?
Thanks for any help
View 10 Replies
View Related
Mar 17, 2014
I've configured log shipping to use for DR purposes. I'm concerned that the physical location of the secondary is mis-reported by SQL Server Management Studio.
Viewing the secondary location (with Studio DB_name Properties Files) shows the path of the primary DB (I expected it to show the path of the secondary).
This SQL command shows the correct/actual paths of both primary and secondary DB's when run on their host servers.
SELECT name, physical_name AS CurrentLocation, state_desc FROM sys.master_files
Is this just cosmetic?
Here is an Example of how the Studio shows the incorrect path for the secondary.
Example:
(Primary) servername=prodSrv, DBname=aquaDB, Actual_Path=G:aquaDB, SQL-studio-Properties-Path=G:AquaDB, sys.master_files Path=G:AquaDB,
Log shipped to
(Secondary / Read Only) servername=DRSrv, DBname=aquaDB, Actual Path=F:aquaDR, SQL-studio-Properties-Path=G:AquaDB(WRONG), sys.master_files Path=F:aquaDR
View 2 Replies
View Related
May 2, 2008
Hi,
Please Help, I am very desparate for a solution to this one.
I have an error appearing
"Error 25115 Wrong Page (potential database corruption). Try Running the Repair Utility."
I have SQL Server Enterprise set up with Merge replication, it is being used to Sync with Windows Mobile Devices as the subscribers.
All the Windows Mobile subscribers have been synchronising fine up until recently, when 1 of the Subscribing Windows Mobile devices received this error.
The day after, another device Synchronised fine the first time (note that the Synchronisation was a long one and the SDF grew in size dramatically while the synchronisation occured, but the Sync worked fine and the SDF dropped back to its initial size) The 2nd sync 5 mins later failed however so this Mobile device has the same error also.
Any suggestions as to the below are much appreciated
a) Why this error occurs?
b)How do you resolve this error?
c)What is the Repair utility mentioned in the error, and is it of use to me?
Thanks in advance, I am very greatful for any advice.
View 8 Replies
View Related
Jan 15, 2008
Is there a way to allow non-sysadmin to modify jobs they don't own from the management studio interface?
Even the most privileged SQLAgentOperatorRole does not allow this...
Thanks
View 10 Replies
View Related
Oct 22, 2007
The following was not written by me but I need to modify it and I am definitely no expert in SQL. It returns a list of files that a user is allowed to access based on whether or not they belong to a specific user group and that group has been granted access to the file.
Here is the SQL as it is currently:
SELECT a.ID, a.Title, a.Description, a.FileName, a.DateCreated, a.DateModified, u.UserName, a.UserID, COUNT(ga.AnswerFileID) AS ShareCount
FROM
User AS u INNER JOIN
AnswerFile AS a LEFT OUTER JOIN
GroupAnswerFile AS ga LEFT OUTER JOIN
GroupUser AS gu
ON ga.GroupID = gu.GroupID ON a.ID = ga.AnswerFileID ON u.ID = a.UserID
GROUP BY a.ID, a.Title, a.Description, a.FileName, a.DateCreated, a.DateModified, a.UserID, u.UserName, gu.UserID
HAVING (gu.UserID = 2)
UNION
SELECT a.ID, a.Title, a.Description, a.FileName, a.DateCreated, a.DateModified, u.UserName, a.UserID, 0 AS ShareCount
FROM AnswerFile AS a INNER JOIN User AS u ON a.UserID = u.ID
WHERE (a.UserID = 2) AND (a.ID NOT IN SELECT AnswerFileID FROM GroupAnswerFile))
I need to modify this code to add an additional check. I have added a file that allows specific users to be granted access to files. It is called AnswerFileUser and contains AnswerFileID (the file) and UserID (the user that has been given access). I need the query to return as part of the results those files where a user has been given access regardless of their group or group access. I hope this all makes sense. Thanks for your help!
Oops - this is SQL 2005...
View 1 Replies
View Related
Jan 2, 2007
give me answer and what's the difference between view and stored procedure
View 2 Replies
View Related
May 18, 2007
How do you change the time out value for a specific connection? I'm having problems when I connect to SQL Server from my website and I want to test if this would help.
View 2 Replies
View Related