Showing posts with label receive. Show all posts
Showing posts with label receive. Show all posts

Sunday, March 25, 2012

attach Help

I received three Files .mdf .ldf .ndf and a text how to use attach
but i always receive an error message "database is write protect ......"
What I do wrong ?
byeFirst of all, what did you do?|||Are the three files read-only at the O/S level? This can happen if the three files were sent as attachments in e-mail.|||could it be that the database already exists and in read-only mode?|||Are we even talking about SQL Server?

And when does the damn weekend start already.....

DECLARE @.Weekend datetime
SELECT @.Weekend = 'Jan 16 2004 17:00:00'
SELECT DATEDIFF(mi, GetDate(), @.Weekend)/60.00 As Hours_till_Margaritaville|||Sorry for mistakes
I'll start again
i have 3 Files xxx.mdf,xxx.ndf,xxx.ldf from originally sql7 ,from network and I'd like to atach to Sqlserver 2000; on sql server 2000 is the database not present
With Query Analyzer I tested i did:
Exec sp_attach_db
@.dbname="xxx",
@.filename1= "xxx.mdf",
@.filename2= "xxx.ndf",
@.filename3= "xxx.ldf"

With Sql 2000 Manager I use The menu attach

In both case i received this message "The Database is write Protect you
have to unptrotect.......

bye|||Right click on each file in succession, go to properties, and see if any of them have the read-only checkbox marked. If so, uncheck that box.|||I checked the free file , they all are not write protect|||As a test, see if you can rename one of the files. Maybe backup software, or virus scan has it open?

I just tried a test of re-attaching a readonly filegroup, and it worked. Although, I do not have access to a 7.0 machine, anymore to try out a readonly filegroup with an upgrade.

That sparks a thought. Do you have access to the database in it's original state? That is, can you see if the original database (on SQL 7.0) is read only or had read only filegroups?|||I can rename the files, and I open the file .ndf with an Hex editor
there are more line with read only inside the file

bye

Monday, March 19, 2012

Assigning XML data to variables

Hi Guys...

Need some assistance here again.
What data type should I use for the variable that I receive from a resultset?

I tried setting it to object, but I encountered some problem later in the stage during the data flow because the XML source adapter cannot get the variable.

I tried setting it to String but get some error during runtime because of invalid datatype.

The main purpose here is actually to get the data from an XML column in a table and populate it into the XML Source Adapter so that I can do some transformations.

Any ideas?

Thanks.Hi,
Yes, this is definitely an issue. In the next release (post- CTP15) you will be able to put the XML result set into a string variable that can then be consumed by the XML Source Adapter. For now, you might be able to work around it with a script component that creates a new string variable and populates it with the data from the object variable. I'm sorry I don't have a better answer for you.

Thanks,
Mark

Sunday, February 19, 2012

ASP: error when trying to insert record

I receive the following error when trying to INSERT INTO; am using Access db.

Microsoft OLE DB Provider for ODBC Drivers error '80040e07'[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.

The code is as follows:

<%
Dim dbConn
set dbConn = server.CreateObject("adodb.connection")
dbConn.open("connect")
dbConn.Execute("INSERT INTO tbl_country (region, countryName, population, country_currency, description, imageURL, imageALT) VALUES ('" & Request.Form("region") & "', '" & Request.Form("countryName") & "', '" & Request.Form("population") & "', '" & Request.Form("country_currency") & "', '" & Request.Form("description") & "', '" & Request.Form("imageURL") & "', '" & Request.Form("imageALT") & "'),")
Response.Redirect("admin_master.asp")
%>

I would greatly appreciate any help you can give me.

Judging by the error message, you are likely trying to insert the wrong datatype into one of the columns..population maybe? I'd have to see the table definition to know for sure..|||

Please verify the Numeric data typed column's values on your query (Request.Form values). If the user given blank input then your query generate the blank string ('') & it will try to insert in the respective column which will throw error.

It always good idea to use the Stored Procedure or Parameterized query. Your code is violating the security standards it will allow the sql injection. Beware of SQL Injection.. Never use Dynamic Queries on your UI


|||+1 against dynamic sql and for paramtrized queries. If you are not sure which statement is executed against the database, put the whole build string into a string variable and output it to the Response stream, you will be easily able to find the error then. In most cases of dynamic SQL and the situations I have seen such implementation like you posted, the problem was based upon a wrong order of the parameters / columns.

Jens K. Suessmeyer.

http://www.sqlserver2005.de
--

Thursday, February 9, 2012

Asp.net 2.0 Registration: Must declare the scalar variable @BillingAddress

I started to receive this error as soon I added the line"DataSource.SelectParameters.Clear()" Otherwise I was getting"variableuserid already decalred". I'm pasting the code below, please let meknow what I'm doing wrong. I think it is a minor problem.

1<%@. Page Language="VB" AutoEventWireup="false" CodeFile="Registration.aspx.vb" Inherits="Members_Registration" Trace="true" %>23<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">45<html xmlns="http://www.w3.org/1999/xhtml" >6<head runat="server">7 <title>Untitled Page</title>8</head>9<body>10 <form id="form1" runat="server">11 <div>12 <asp:CreateUserWizard ID="CreateUserWizard1" runat="server" BackColor="#FFFBD6" BorderColor="#FFDFAD" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em" OnCreatedUser="CreateUserWizard1_CreatedUser">13 <WizardSteps>14 <asp:WizardStep ID="CreateUserWizardStep0" runat="server">15 <table>16 <tr>17 <th>Billing Information</th>18 </tr>19 <tr>20 <td>Billing Address:</td>21 <td>22 <asp:TextBox runat="server" ID="BillingAddress" MaxLength="50" />23 <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator1" ControlToValidate="BillingAddress"24 ErrorMessage="Billing Address is required." />25 </td>26 </tr>27 <tr>28 <td>Billing City:</td>29 <td>30 <asp:TextBox runat="server" ID="BillingCity" MaxLength="50" Columns="15" />31 <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator2" ControlToValidate="BillingCity"32 ErrorMessage="Billing City is required." />33 </td>34 </tr>35 <tr>36 <td>Billing State:</td>37 <td>38 <asp:TextBox runat="server" ID="BillingState" MaxLength="25" Columns="10" />39 <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator3" ControlToValidate="BillingState"40 ErrorMessage="Billing State is required." />41 </td>42 </tr>43 <tr>44 <td>Billing Zip:</td>45 <td>46 <asp:TextBox runat="server" ID="BillingZip" MaxLength="10" Columns="10" />47 <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator4" ControlToValidate="BillingZip"48 ErrorMessage="Billing Zip is required." />49 </td>50 </tr>51 </table>52 </asp:WizardStep>53 <asp:WizardStep ID="CreateUserWizardStep1" runat="server">54 <table>55 <tr>56 <th>Shipping Information</th>57 </tr>58 <tr>59 <td>Shipping Address:</td>60 <td>61 <asp:TextBox runat="server" ID="ShippingAddress" MaxLength="50" />62 <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator5" ControlToValidate="ShippingAddress"63 ErrorMessage="Shipping Address is required." />64 </td>65 </tr>66 <tr>67 <td>Shipping City:</td>68 <td>69 <asp:TextBox runat="server" ID="ShippingCity" MaxLength="50" Columns="15" />70 <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator6" ControlToValidate="ShippingCity"71 ErrorMessage="Shipping City is required." />72 </td>73 </tr>74 <tr>75 <td>Shipping State:</td>76 <td>77 <asp:TextBox runat="server" ID="ShippingState" MaxLength="25" Columns="10" />78 <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator7" ControlToValidate="ShippingState"79 ErrorMessage="Shipping State is required." />80 </td>81 </tr>82 <tr>83 <td>Shipping Zip:</td>84 <td>85 <asp:TextBox runat="server" ID="ShippingZip" MaxLength="10" Columns="10" />86 <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator8" ControlToValidate="ShippingZip"87 ErrorMessage="Shipping Zip is required." />88 </td>89 </tr>90 </table>91 </asp:WizardStep>92 <asp:CreateUserWizardStep ID="CreateUserWizardStep2" runat="server">93 <ContentTemplate>94 <table>95 <tr>96 <th>User Information</th>97 </tr>98 <tr>99 <td>Username:</td>100 <td>101 <asp:TextBox runat="server" ID="UserName" />102 <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator9" ControlToValidate="UserName"103 ErrorMessage="Username is required." />104 </td>105 </tr>106 <tr>107 <td>Password:</td>108 <td>109 <asp:TextBox runat="server" ID="Password" TextMode="Password" />110 <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator10" ControlToValidate="Password"111 ErrorMessage="Password is required." />112 </td>113 </tr>114 <tr>115 <td>Confirm Password:</td>116 <td>117 <asp:TextBox runat="server" ID="ConfirmPassword" TextMode="Password" />118 <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator13" ControlToValidate="ConfirmPassword"119 ErrorMessage="Confirm Password is required." />120 </td>121 </tr>122 <tr>123 <td>Email:</td>124 <td>125 <asp:TextBox runat="server" ID="Email" />126 <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator11" ControlToValidate="Email"127 ErrorMessage="Email is required." />128 </td>129 </tr>130 <tr>131 <td>Question:</td>132 <td>133 <asp:TextBox runat="server" ID="Question" />134 <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator12" ControlToValidate="Question"135 ErrorMessage="Question is required." />136 </td>137 </tr>138 <tr>139 <td>Answer:</td>140 <td>141 <asp:TextBox runat="server" ID="Answer" />142 <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator14" ControlToValidate="Answer"143 ErrorMessage="Answer is required." />144 </td>145 </tr>146 <tr>147 <td colspan="2">148 <asp:CompareValidator ID="PasswordCompare" runat="server" ControlToCompare="Password"149 ControlToValidate="ConfirmPassword" Display="Dynamic" ErrorMessage="The Password and Confirmation Password must match."></asp:CompareValidator>150 </td>151 </tr>152 <tr>153 <td colspan="2">154 <asp:Literal ID="ErrorMessage" runat="server" EnableViewState="False"></asp:Literal>155 </td>156 </tr>157 </table>158159160 <asp:SqlDataSource ID="InsertExtraInfo" runat="server"161 ConnectionString="<%$ ConnectionStrings:Member %>"162 InsertCommand="INSERT INTO UserAddress (Userid, BillingAddress, BillingCity,BillingState,BillingZip, ShippingAddress,ShippingCity,ShippingState,ShippingZip) VALUES (@.userid, @.BillingAddress, @.BillingCity, @.BillingState, @.BillingZip, @.ShippingAddress, @.ShippingCity, @.ShippingState, @.ShippingZip)"163 SelectCommand="SELECT UserAddress.* FROM UserAddress">164 <InsertParameters>165 <asp:ControlParameter Name="BillingAddress" Type="String" ControlID="BillingAddress" PropertyName="Text" />166 <asp:ControlParameter Name="BillingCity" Type="String" ControlID="BillingCity" PropertyName="Text" />167 <asp:ControlParameter Name="BillingState" Type="String" ControlID="BillingState" PropertyName="Text" />168 <asp:ControlParameter Name="BillingZip" Type="String" ControlID="BillingZip" PropertyName="Text" />169 <asp:ControlParameter Name="ShippingAddress" Type="String" ControlID="ShippingAddress" PropertyName="Text" />170 <asp:ControlParameter Name="ShippingCity" Type="String" ControlID="ShippingCity" PropertyName="Text" />171 <asp:ControlParameter Name="ShippingState" Type="String" ControlID="ShippingState" PropertyName="Text" />172 <asp:ControlParameter Name="ShippingZip" Type="String" ControlID="ShippingZip" PropertyName="Text" />173 </InsertParameters>174 </asp:SqlDataSource>175176 </ContentTemplate>177 </asp:CreateUserWizardStep>178 <asp:CompleteWizardStep ID="CompleteWizardStep1" runat="server">179 </asp:CompleteWizardStep>180 </WizardSteps>181 <NavigationButtonStyle BackColor="White" BorderColor="#CC9966" BorderStyle="Solid"182 BorderWidth="1px" Font-Names="Verdana" ForeColor="#990000" />183 <HeaderStyle BackColor="#FFCC66" BorderColor="#FFFBD6" BorderStyle="Solid" BorderWidth="2px"184 Font-Bold="True" Font-Size="0.9em" ForeColor="#333333" HorizontalAlign="Center" />185 <CreateUserButtonStyle BackColor="White" BorderColor="#CC9966" BorderStyle="Solid"186 BorderWidth="1px" Font-Names="Verdana" ForeColor="#990000" />187 <ContinueButtonStyle BackColor="White" BorderColor="#CC9966" BorderStyle="Solid"188 BorderWidth="1px" Font-Names="Verdana" ForeColor="#990000" />189 <SideBarStyle BackColor="#990000" Font-Size="0.9em" VerticalAlign="Top" />190 <TitleTextStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />191 <SideBarButtonStyle ForeColor="White" />192 </asp:CreateUserWizard>193194 </div>195196 </form>197</body>198</html>199200  
PartialClass Members_RegistrationInherits System.Web.UI.PageProtected Sub CreateUserWizard1_CreatedUser(ByVal senderAs Object,ByVal eAs System.EventArgs)Handles CreateUserWizard1.CreatedUserDim UserNameTextBoxAs TextBox =DirectCast(CreateUserWizardStep2.ContentTemplateContainer.FindControl("UserName"), TextBox)Dim DataSourceAs SqlDataSource =DirectCast(CreateUserWizardStep2.ContentTemplateContainer.FindControl("InsertExtraInfo"), SqlDataSource)Dim UserAs MembershipUser User = Membership.GetUser(UserNameTextBox.Text)Dim UserGUID UserGUID = User.ProviderUserKey Trace.Write("userid", UserGUID.ToString) DataSource.SelectParameters.Clear()' DataSource.InsertParameters.Clear() DataSource.InsertParameters.Add("UserId", UserGUID.ToString) DataSource.Insert()End SubEnd Class

Maybe a typo..... Dim UserGUID? Should be Dim UserGUID as GUID? I think I had a problem with that parameters.clear method also, so I added a check to see if there are any parameters before clearing,

IfMe.UsersObjectDataSource.SelectParameters.Count > 0Then

Me.UsersObjectDataSource.SelectParameters.Clear()

EndIf

Burl