Showing posts with label lines. Show all posts
Showing posts with label lines. Show all posts

Thursday, March 29, 2012

DataTransfer Error

I have written following lines of code, but when TransferData() method is called, it generates error "Property LoginSecure cannot be changed or read after a connection string has been set."

Can anybody help me? Thanks in advance....

Code:

//1. Create Transfer Object

Transfer transObj = new Transfer();

//transObj=new Transfer(server.Databases[fromdatabasename]);

transObj.DestinationLoginSecure = false;

transObj.DestinationLogin = "sa";

transObj.DestinationPassword = "test";

//Set Destination Server

//Build a "serverConnection" with the information of the "sqlConnection"

destSrvCon =

new ServerConnection(sqlCon);

//The serverConnection is used in the ctor of the Server.

destServer = new Server(destSrvCon);

transObj.DestinationServer = destServer.Name.ToString();

//2. Define Transfer Object's Properties

transObj.Database = server.Databases["Aworks"];

transObj.DestinationDatabase = "AWorksCopy";

transObj.Options.WithDependencies =true;

transObj.Options.ContinueScriptingOnError = true;

transObj.CopySchema = true;

transObj.CopyData = true;

transObj.CopyAllTables = true;

//4. Finally Transfer Data

transObj.TransferData();

//transObj.ScriptTransfer();

I got this error as well, and have tried everything to avoid it. The only explanation I have left is that I'm using server 2000. Is this what you're using Ritesh?
|||I got this error as well. I changed the file permissions on the ReplData folder and it went away.|||

i get this same error.

did you guys resolve the problem?

ReplData folder? only folder i can think of is the folder where the database files are stored....

DataTransfer Error

I have written following lines of code, but when TransferData() method is called, it generates error "Property LoginSecure cannot be changed or read after a connection string has been set."

Can anybody help me? Thanks in advance....

Code:

//1. Create Transfer Object

Transfer transObj = new Transfer();

//transObj=new Transfer(server.Databases[fromdatabasename]);

transObj.DestinationLoginSecure = false;

transObj.DestinationLogin = "sa";

transObj.DestinationPassword = "test";

//Set Destination Server

//Build a "serverConnection" with the information of the "sqlConnection"

destSrvCon =

new ServerConnection(sqlCon);

//The serverConnection is used in the ctor of the Server.

destServer = new Server(destSrvCon);

transObj.DestinationServer = destServer.Name.ToString();

//2. Define Transfer Object's Properties

transObj.Database = server.Databases["Aworks"];

transObj.DestinationDatabase = "AWorksCopy";

transObj.Options.WithDependencies =true;

transObj.Options.ContinueScriptingOnError = true;

transObj.CopySchema = true;

transObj.CopyData = true;

transObj.CopyAllTables = true;

//4. Finally Transfer Data

transObj.TransferData();

//transObj.ScriptTransfer();

I got this error as well, and have tried everything to avoid it. The only explanation I have left is that I'm using server 2000. Is this what you're using Ritesh?
|||I got this error as well. I changed the file permissions on the ReplData folder and it went away.|||

i get this same error.

did you guys resolve the problem?

ReplData folder? only folder i can think of is the folder where the database files are stored....

DataTransfer Error

I have written following lines of code, but when TransferData() method is called, it generates error "Property LoginSecure cannot be changed or read after a connection string has been set."

Can anybody help me? Thanks in advance....

Code:

//1. Create Transfer Object

Transfer transObj = new Transfer();

//transObj=new Transfer(server.Databases[fromdatabasename]);

transObj.DestinationLoginSecure = false;

transObj.DestinationLogin = "sa";

transObj.DestinationPassword = "test";

//Set Destination Server

//Build a "serverConnection" with the information of the "sqlConnection"

destSrvCon =

new ServerConnection(sqlCon);

//The serverConnection is used in the ctor of the Server.

destServer = new Server(destSrvCon);

transObj.DestinationServer = destServer.Name.ToString();

//2. Define Transfer Object's Properties

transObj.Database = server.Databases["Aworks"];

transObj.DestinationDatabase = "AWorksCopy";

transObj.Options.WithDependencies =true;

transObj.Options.ContinueScriptingOnError = true;

transObj.CopySchema = true;

transObj.CopyData = true;

transObj.CopyAllTables = true;

//4. Finally Transfer Data

transObj.TransferData();

//transObj.ScriptTransfer();

I got this error as well, and have tried everything to avoid it. The only explanation I have left is that I'm using server 2000. Is this what you're using Ritesh?
|||I got this error as well. I changed the file permissions on the ReplData folder and it went away.|||

i get this same error.

did you guys resolve the problem?

ReplData folder? only folder i can think of is the folder where the database files are stored....

DataTransfer Error

I have written following lines of code, but when TransferData() method is called, it generates error "Property LoginSecure cannot be changed or read after a connection string has been set."

Can anybody help me? Thanks in advance....

Code:

//1. Create Transfer Object

Transfer transObj = new Transfer();

//transObj=new Transfer(server.Databases[fromdatabasename]);

transObj.DestinationLoginSecure = false;

transObj.DestinationLogin = "sa";

transObj.DestinationPassword = "test";

//Set Destination Server

//Build a "serverConnection" with the information of the "sqlConnection"

destSrvCon =

new ServerConnection(sqlCon);

//The serverConnection is used in the ctor of the Server.

destServer = new Server(destSrvCon);

transObj.DestinationServer = destServer.Name.ToString();

//2. Define Transfer Object's Properties

transObj.Database = server.Databases["Aworks"];

transObj.DestinationDatabase = "AWorksCopy";

transObj.Options.WithDependencies =true;

transObj.Options.ContinueScriptingOnError = true;

transObj.CopySchema = true;

transObj.CopyData = true;

transObj.CopyAllTables = true;

//4. Finally Transfer Data

transObj.TransferData();

//transObj.ScriptTransfer();

I got this error as well, and have tried everything to avoid it. The only explanation I have left is that I'm using server 2000. Is this what you're using Ritesh?
|||I got this error as well. I changed the file permissions on the ReplData folder and it went away.|||

i get this same error.

did you guys resolve the problem?

ReplData folder? only folder i can think of is the folder where the database files are stored....

Thursday, March 22, 2012

Dataset Query Size limit (300 lines)

Hi,
I have a formatted Dataset query with size exceeding 300 lines (vertically). The dataset editor is not allowing me write it. Is this a limitation that the query size should be less than 300 lines or do we need have any way to increase this.
Formatting helps understand the query it in a legible format.
ThanksBy "dataset editor" do you mean the Dataset dialog, generic query designer
or graphical query designer? How long is the query in characters? What do
you mean by "not allowing me to write it"? Do you get an error message?
--
Albert Yen
SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"push" <push@.discussions.microsoft.com> wrote in message
news:274D4735-1AB9-487A-ADAF-A3295EBF309F@.microsoft.com...
> Hi,
> I have a formatted Dataset query with size exceeding 300 lines
(vertically). The dataset editor is not allowing me write it. Is this a
limitation that the query size should be less than 300 lines or do we need
have any way to increase this.
> Formatting helps understand the query it in a legible format.
> Thanks|||Apologise for this confusion.....I talked about the generic Query Designer [Report Design Window --> Data Tab -- > Place where the query is written]
I have a query as, say,
"select " & Parameters!col_name>Value & " as myValue from dual UNION ALL ...(almost 18k characters)"...
I wrote the above query as follows (for legibility)
" select " & Parameters!col_name>Value & " as myValue " & (press enter)
" from dual " & (press enter)
" UNION ALL " & (press enter)
... (exceeds 300 lines vertically now)
Here, i notice that only 300 lines come in the window and after that it does not paste or allow me manually write the query. Nothing happens when i write.
Kinldy let me know if it cannot work beyond this or a solution.
"Albert Yen [MSFT]" wrote:
> By "dataset editor" do you mean the Dataset dialog, generic query designer
> or graphical query designer? How long is the query in characters? What do
> you mean by "not allowing me to write it"? Do you get an error message?
> --
> Albert Yen
> SQL Server Reporting Services
> This posting is provided "AS IS" with no warranties, and confers no rights.
> "push" <push@.discussions.microsoft.com> wrote in message
> news:274D4735-1AB9-487A-ADAF-A3295EBF309F@.microsoft.com...
> > Hi,
> >
> > I have a formatted Dataset query with size exceeding 300 lines
> (vertically). The dataset editor is not allowing me write it. Is this a
> limitation that the query size should be less than 300 lines or do we need
> have any way to increase this.
> >
> > Formatting helps understand the query it in a legible format.
> >
> > Thanks
>
>|||I am unable to reproduce your problem with a query with up to 600 lines and
30K characters. Could you post the text of your query? Although, it would
seem strange if the specific text made any difference.
--
Albert Yen
SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"push" <push@.discussions.microsoft.com> wrote in message
news:8B9DF816-0E7D-45A7-8D80-03FA376EB94E@.microsoft.com...
> Apologise for this confusion.....I talked about the generic Query
Designer [Report Design Window --> Data Tab -- > Place where the query is
written]
> I have a query as, say,
> "select " & Parameters!col_name>Value & " as myValue from dual UNION ALL
...(almost 18k characters)"...
> I wrote the above query as follows (for legibility)
> " select " & Parameters!col_name>Value & " as myValue " & (press enter)
> " from dual " & (press enter)
> " UNION ALL " & (press enter)
> ... (exceeds 300 lines vertically now)
> Here, i notice that only 300 lines come in the window and after that it
does not paste or allow me manually write the query. Nothing happens when i
write.
> Kinldy let me know if it cannot work beyond this or a solution.
> "Albert Yen [MSFT]" wrote:
> > By "dataset editor" do you mean the Dataset dialog, generic query
designer
> > or graphical query designer? How long is the query in characters? What
do
> > you mean by "not allowing me to write it"? Do you get an error message?
> >
> > --
> > Albert Yen
> > SQL Server Reporting Services
> >
> > This posting is provided "AS IS" with no warranties, and confers no
rights.
> >
> > "push" <push@.discussions.microsoft.com> wrote in message
> > news:274D4735-1AB9-487A-ADAF-A3295EBF309F@.microsoft.com...
> > > Hi,
> > >
> > > I have a formatted Dataset query with size exceeding 300 lines
> > (vertically). The dataset editor is not allowing me write it. Is this a
> > limitation that the query size should be less than 300 lines or do we
need
> > have any way to increase this.
> > >
> > > Formatting helps understand the query it in a legible format.
> > >
> > > Thanks
> >
> >
> >|||Well, this is really strange.
Please follow the process as,
format the query in an editor (textpad, in my case) with an enter character after every line. Copy this query which is beyond, say 400 lines, and paste it directly in datatset querystrign editor. Are you sure you get the complete query in the window. Try copying it back to the textpad editor and check for the number of lines.
My focus is primarily on having the copy and paste operation performed, as i did. Otherwise, if you can suggest any probable reason for this behaviour..
Thanks.
"Albert Yen [MSFT]" wrote:
> I am unable to reproduce your problem with a query with up to 600 lines and
> 30K characters. Could you post the text of your query? Although, it would
> seem strange if the specific text made any difference.
> --
> Albert Yen
> SQL Server Reporting Services
> This posting is provided "AS IS" with no warranties, and confers no rights.
> "push" <push@.discussions.microsoft.com> wrote in message
> news:8B9DF816-0E7D-45A7-8D80-03FA376EB94E@.microsoft.com...
> > Apologise for this confusion.....I talked about the generic Query
> Designer [Report Design Window --> Data Tab -- > Place where the query is
> written]
> > I have a query as, say,
> > "select " & Parameters!col_name>Value & " as myValue from dual UNION ALL
> ...(almost 18k characters)"...
> > I wrote the above query as follows (for legibility)
> > " select " & Parameters!col_name>Value & " as myValue " & (press enter)
> > " from dual " & (press enter)
> > " UNION ALL " & (press enter)
> > ... (exceeds 300 lines vertically now)
> >
> > Here, i notice that only 300 lines come in the window and after that it
> does not paste or allow me manually write the query. Nothing happens when i
> write.
> > Kinldy let me know if it cannot work beyond this or a solution.
> >
> > "Albert Yen [MSFT]" wrote:
> >
> > > By "dataset editor" do you mean the Dataset dialog, generic query
> designer
> > > or graphical query designer? How long is the query in characters? What
> do
> > > you mean by "not allowing me to write it"? Do you get an error message?
> > >
> > > --
> > > Albert Yen
> > > SQL Server Reporting Services
> > >
> > > This posting is provided "AS IS" with no warranties, and confers no
> rights.
> > >
> > > "push" <push@.discussions.microsoft.com> wrote in message
> > > news:274D4735-1AB9-487A-ADAF-A3295EBF309F@.microsoft.com...
> > > > Hi,
> > > >
> > > > I have a formatted Dataset query with size exceeding 300 lines
> > > (vertically). The dataset editor is not allowing me write it. Is this a
> > > limitation that the query size should be less than 300 lines or do we
> need
> > > have any way to increase this.
> > > >
> > > > Formatting helps understand the query it in a legible format.
> > > >
> > > > Thanks
> > >
> > >
> > >
>
>|||I do see a limit of 32K characters in the textbox, after which I can't enter
any more text. I think the 32K character limit is imposed by the textbox
control, not us. That sounds like what you are seeing, except it's a limit
on the number of characters, not the number of lines. I'm not sure why you
have a problem after only 18K characters. At any rate, I don't have any
workarounds for this problem.
--
Albert Yen
SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"push" <push@.discussions.microsoft.com> wrote in message
news:5637124F-6032-4D36-A8F3-E73F4F68E44D@.microsoft.com...
> Well, this is really strange.
> Please follow the process as,
> format the query in an editor (textpad, in my case) with an enter
character after every line. Copy this query which is beyond, say 400 lines,
and paste it directly in datatset querystrign editor. Are you sure you get
the complete query in the window. Try copying it back to the textpad editor
and check for the number of lines.
> My focus is primarily on having the copy and paste operation performed, as
i did. Otherwise, if you can suggest any probable reason for this
behaviour..
> Thanks.
> "Albert Yen [MSFT]" wrote:
> > I am unable to reproduce your problem with a query with up to 600 lines
and
> > 30K characters. Could you post the text of your query? Although, it
would
> > seem strange if the specific text made any difference.
> >
> > --
> > Albert Yen
> > SQL Server Reporting Services
> >
> > This posting is provided "AS IS" with no warranties, and confers no
rights.
> >
> > "push" <push@.discussions.microsoft.com> wrote in message
> > news:8B9DF816-0E7D-45A7-8D80-03FA376EB94E@.microsoft.com...
> > > Apologise for this confusion.....I talked about the generic Query
> > Designer [Report Design Window --> Data Tab -- > Place where the query
is
> > written]
> > > I have a query as, say,
> > > "select " & Parameters!col_name>Value & " as myValue from dual UNION
ALL
> > ...(almost 18k characters)"...
> > > I wrote the above query as follows (for legibility)
> > > " select " & Parameters!col_name>Value & " as myValue " & (press
enter)
> > > " from dual " & (press enter)
> > > " UNION ALL " & (press enter)
> > > ... (exceeds 300 lines vertically now)
> > >
> > > Here, i notice that only 300 lines come in the window and after that
it
> > does not paste or allow me manually write the query. Nothing happens
when i
> > write.
> > > Kinldy let me know if it cannot work beyond this or a solution.
> > >
> > > "Albert Yen [MSFT]" wrote:
> > >
> > > > By "dataset editor" do you mean the Dataset dialog, generic query
> > designer
> > > > or graphical query designer? How long is the query in characters?
What
> > do
> > > > you mean by "not allowing me to write it"? Do you get an error
message?
> > > >
> > > > --
> > > > Albert Yen
> > > > SQL Server Reporting Services
> > > >
> > > > This posting is provided "AS IS" with no warranties, and confers no
> > rights.
> > > >
> > > > "push" <push@.discussions.microsoft.com> wrote in message
> > > > news:274D4735-1AB9-487A-ADAF-A3295EBF309F@.microsoft.com...
> > > > > Hi,
> > > > >
> > > > > I have a formatted Dataset query with size exceeding 300 lines
> > > > (vertically). The dataset editor is not allowing me write it. Is
this a
> > > > limitation that the query size should be less than 300 lines or do
we
> > need
> > > > have any way to increase this.
> > > > >
> > > > > Formatting helps understand the query it in a legible format.
> > > > >
> > > > > Thanks
> > > >
> > > >
> > > >
> >
> >
> >|||Is it practical for you to write the query as a stored procedure and call it
from the report?
"Albert Yen [MSFT]" wrote:
> I do see a limit of 32K characters in the textbox, after which I can't enter
> any more text. I think the 32K character limit is imposed by the textbox
> control, not us. That sounds like what you are seeing, except it's a limit
> on the number of characters, not the number of lines. I'm not sure why you
> have a problem after only 18K characters. At any rate, I don't have any
> workarounds for this problem.
> --
> Albert Yen
> SQL Server Reporting Services
> This posting is provided "AS IS" with no warranties, and confers no rights.
> "push" <push@.discussions.microsoft.com> wrote in message
> news:5637124F-6032-4D36-A8F3-E73F4F68E44D@.microsoft.com...
> > Well, this is really strange.
> > Please follow the process as,
> > format the query in an editor (textpad, in my case) with an enter
> character after every line. Copy this query which is beyond, say 400 lines,
> and paste it directly in datatset querystrign editor. Are you sure you get
> the complete query in the window. Try copying it back to the textpad editor
> and check for the number of lines.
> >
> > My focus is primarily on having the copy and paste operation performed, as
> i did. Otherwise, if you can suggest any probable reason for this
> behaviour..
> >
> > Thanks.
> >
> > "Albert Yen [MSFT]" wrote:
> >
> > > I am unable to reproduce your problem with a query with up to 600 lines
> and
> > > 30K characters. Could you post the text of your query? Although, it
> would
> > > seem strange if the specific text made any difference.
> > >
> > > --
> > > Albert Yen
> > > SQL Server Reporting Services
> > >
> > > This posting is provided "AS IS" with no warranties, and confers no
> rights.
> > >
> > > "push" <push@.discussions.microsoft.com> wrote in message
> > > news:8B9DF816-0E7D-45A7-8D80-03FA376EB94E@.microsoft.com...
> > > > Apologise for this confusion.....I talked about the generic Query
> > > Designer [Report Design Window --> Data Tab -- > Place where the query
> is
> > > written]
> > > > I have a query as, say,
> > > > "select " & Parameters!col_name>Value & " as myValue from dual UNION
> ALL
> > > ...(almost 18k characters)"...
> > > > I wrote the above query as follows (for legibility)
> > > > " select " & Parameters!col_name>Value & " as myValue " & (press
> enter)
> > > > " from dual " & (press enter)
> > > > " UNION ALL " & (press enter)
> > > > ... (exceeds 300 lines vertically now)
> > > >
> > > > Here, i notice that only 300 lines come in the window and after that
> it
> > > does not paste or allow me manually write the query. Nothing happens
> when i
> > > write.
> > > > Kinldy let me know if it cannot work beyond this or a solution.
> > > >
> > > > "Albert Yen [MSFT]" wrote:
> > > >
> > > > > By "dataset editor" do you mean the Dataset dialog, generic query
> > > designer
> > > > > or graphical query designer? How long is the query in characters?
> What
> > > do
> > > > > you mean by "not allowing me to write it"? Do you get an error
> message?
> > > > >
> > > > > --
> > > > > Albert Yen
> > > > > SQL Server Reporting Services
> > > > >
> > > > > This posting is provided "AS IS" with no warranties, and confers no
> > > rights.
> > > > >
> > > > > "push" <push@.discussions.microsoft.com> wrote in message
> > > > > news:274D4735-1AB9-487A-ADAF-A3295EBF309F@.microsoft.com...
> > > > > > Hi,
> > > > > >
> > > > > > I have a formatted Dataset query with size exceeding 300 lines
> > > > > (vertically). The dataset editor is not allowing me write it. Is
> this a
> > > > > limitation that the query size should be less than 300 lines or do
> we
> > > need
> > > > > have any way to increase this.
> > > > > >
> > > > > > Formatting helps understand the query it in a legible format.
> > > > > >
> > > > > > Thanks
> > > > >
> > > > >
> > > > >
> > >
> > >
> > >
>
>sql

Monday, March 19, 2012

datareader wont read first line of DB

hi there, i have some code which cycles through my table in my DB and fills some textboxes. For some reason if there are 5 lines it will only get 4, yet strangly i used the code somewhere else for the same kind of thing and it reads all the lines, and anyone help?

int a = 0;int b = 0;

//This is the sql statement.

string sqlMultiL ="SELECT * FROM tbl_stock_part_multi_location WHERE stock_ID =" +Convert.ToInt32(Request.QueryString["qsStockID"]);// + ") AND EXISTS (SELECT * FROM tbl_stock_part_multi_location WHERE stock_ID =" + Convert.ToInt32(Request.QueryString["qsStockID"]) + ")";

//This creates a sql command which executes the sql statement.

SqlCommand sqlCmdMultiL =new SqlCommand(sqlMultiL, myConnMultiL);

myConnMultiL.Open();

SqlDataReader drMultiL = sqlCmdMultiL.ExecuteReader();

//This reads the first result from the sqlReader

while (drMultiL.Read())

{

try

{

((TextBox)Panel2.FindControl("txtDesc_L" + a.ToString())).Text =Convert.ToString(drMultiL["description"]);

for (b = 1; b <= 5; b++)

{

((TextBox)Panel2.FindControl("txtQty" + b.ToString() +"_L" + a.ToString())).Text =Convert.ToString(drMultiL["qty" + b.ToString()]);

}// end of for b loop

}

catch (Exception exMultiL)

{

lblError.Text = lblError +Convert.ToString(exMultiL);

}

//increase the counter

a++;

// you can add a break if you only want 5 rows returned:

if (a >= 5)break;

}

also i dont know if anyone could answer this is if the value in my DB is not = to one in the DDL how can i handle that so it dosnt throw an error and cause my code to stop?

Thanks in advance

Jez

Change to

for (b = 0; b <= 5; b++) //You need to start from the 0

{

a++; //Here you missed

((TextBox)Panel2.FindControl("txtQty" + a.ToString() +"_L" + a.ToString())).Text =Convert.ToString(drMultiL["qty" + a.ToString()]); //Need to change to a too

}// end of for b loop

|||

hi gave that a go and still no luck :( i have tried changing it to 0 before by my controls start from 1 etc. As for changing the controls all to a.ToString() i think thats wrong because it would just do txtQty1_L1, txtQty2_L2 etc instead of going from 1 - 5 and then to the next L