新手急求如何修改sql数据库的路径!!!!!!!!!!!!!!!

gxxfw 2010-08-14 06:37:30
我的数据库的连接字符串:
"provider=sqloledb;data source=98.126.77.163,1433;User ID=a0814143408;pwd=65319662;Initial Catalog=a0814143408"
但是要在下面的2个文件中修改路径我看不懂
第一个文件
<?xml version="1.0"?>
<BaseConfigInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Dbconnectstring>Data Source=(local);User ID=zmdfz;Password=zmdfz888;Initial Catalog=zmdfz;Pooling=true</Dbconnectstring>
<Tableprefix>dnt_</Tableprefix>
<Forumpath>/bbs/</Forumpath>
<Dbtype>SqlServer</Dbtype>
<Founderuid>1</Founderuid>
</BaseConfigInfo>

第二个文件
<?xml version="1.0" encoding="utf-8"?>
<!--
注意: 除了手动编辑此文件以外,您还可以使用
Web 管理工具来配置应用程序的设置。可以使用 Visual Studio 中的
“网站”->“Asp.Net 配置”选项。

设置和注释的完整列表在
machine.config.comments 中,该文件通常位于
\Windows\Microsoft.Net\Framework\v2.x\Config 中

-->
<configuration>
<configSections>
<section name="urlrewritingnet" type="UrlRewritingNet.Configuration.UrlRewriteSection, UrlRewritingNet.UrlRewriter" />
<section name="TinyMCE" type="Moxiecode.TinyMCE.ConfigHandler,Moxiecode.TinyMCE" requirePermission="false" />
</configSections>
<TinyMCE installPath="~/inc/tiny_mce" mode="src">
<!-- Default settings for all TinyMCE instances -->
<globalSettings>
<add key="relative_urls" value="false" />
</globalSettings>

<!-- Compressor specific settings -->
<gzipCompressor enabled="no" diskCache="no" cachePath="c:\temp" expiresOffset="10d" />
</TinyMCE>


<urlrewritingnet configSource="ExternalRewrite.config" />

<appSettings>
<add key="Domain" value="" /> <!--作用:设置cookie的作用域。修改方法:修改为对应的域名如“9eat.com”。使用小写字符。(注意:本地localhost或127.0.0.1等调试不要填写,请留空)-->
<add key="DomainList" value="localhost|zmdfz.com" /><!--本站的多个主要域名。使用小写字符。不要写商家的域名。-->
<add key="ForThisProvince" value="河南" /><!--省名称-->
<add key="ForThisCity" value="驻马店" /><!--城市名称-->
<add key="ForThisTitle" value="驻马店城市通-打造一站式城市消费服务平台,美食,驻马店酒店,驻马店美食,驻马店旅游,驻马店消费" /><!--首页title-->

</appSettings>

<connectionStrings>
<add name="connectionString" connectionString="server=localhost;database=zmdfz;uid=zmdfz;pwd=zmdfz888; Max Pool Size=1500; Min Pool Size=1" providerName="System.Data.SqlClient" />
<add name="House_connectionString" connectionString="server=localhost;database=d0577house;uid=sa;pwd=128897_ka" providerName="System.Data.SqlClient" />
</connectionStrings>



<system.web>

<httpModules>
<add type="Discuz.Forum.HttpModule, Discuz.Forum" name="HttpModule" />
<add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter" />

</httpModules>

<!--
设置 compilation debug="true" 将调试符号插入

已编译的页面中。但由于这会
影响性能,因此只在开发过程中将此值
设置为 true。
元true
-->
<compilation defaultLanguage="c#" debug="true">
<assemblies>
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
</assemblies>
</compilation>
<!--
通过 <authentication> 节可以配置 ASP.NET 使用的
安全身份验证模式,

以标识传入的用户。
-->
<authentication mode="Windows" />

<!--
如果在执行请求的过程中出现未处理的错误,
则通过 <customErrors> 节可以配置相应的处理步骤。具体说来,
开发人员通过该节可以配置
要显示的 html 错误页

以代替错误堆栈跟踪。

-->

<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>

<!-- 会话状态设置

默认情况下,ASP.NET 使用 Cookie 来标识哪些请求属于特定的会话。

如果 Cookie 不可用,则可以通过将会话标识符添加到 URL 来跟踪会话。

若要禁用 Cookie,请设置 sessionState cookieless="true"。

-->
<sessionState mode="InProc" stateConnectionString="tcpip=localhost:42424" sqlConnectionString="data source=localhost;Trusted_Connection=yes" cookieless="false" timeout="20" />

<globalization requestEncoding="utf-8" responseEncoding="utf-8" fileEncoding="utf-8" culture="zh-CN" />
<webServices>
<protocols>
<add name="HttpPost" />
<add name="HttpGet" />
</protocols>
</webServices>
<pages validateRequest="false" enableEventValidation="false" enableViewStateMac="false" viewStateEncryptionMode="Never" />
<httpHandlers>
<add verb="*" path="ajaxpro/*.ashx" type="AjaxPro.AjaxHandlerFactory,AjaxPro.2" />
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />
<add verb="GET,HEAD,POST" path="TinyMCE.ashx" type="Moxiecode.TinyMCE.Web.HttpHandler,Moxiecode.TinyMCE" />

</httpHandlers>


</system.web>
<system.webServer>

<handlers>
<add name="ASPNET-ISAPI" path="*.html" verb="GET,POST,HEAD,DEBUG" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv2.0,bitness32" />
</handlers>

</system.webServer>

</configuration>
...全文
355 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
gxxfw 2010-08-14
  • 打赏
  • 举报
回复
谢谢,我是一菜鸟,能够具体一些吗,直接点吧,把那一段代码提供给我,谢谢!
cxmcxm 2010-08-14
  • 打赏
  • 举报
回复
是否要原设置改为连接到你的数据库
如果是,将你数据库的data source,user id,pwd,Initial Catalog 替换文档中的相应的值即可

server=localhost;database=zmdfz;uid=zmdfz;pwd=zmdfz888;
这一串是odbc的写法,你那一串是oledb写法,用你那一串直接替换也可以,或者server对应data source,database对应initial catalog
uid对应,pwd对应 user id,pwd,即可
个人试过,对sqlclient的sqlconnection对象的连接串,用odbc,ado的连接串都可通过.
gxxfw 2010-08-14
  • 打赏
  • 举报
回复
1楼的你的意思我知道,现在我就是不要本机的数据库,我是要用买的空间的数据库,上面有我的空间的数据库的调用代码,但是我就是不知道该怎么去修改这个代码了!
gxxfw 2010-08-14
  • 打赏
  • 举报
回复
2楼你说的对,但是我修改的人家的源码,人家的源码是这样的:
<connectionStrings>
<add name="connectionString" connectionString="server=localhost;database=zmdfz;uid=zmdfz;pwd=zmdfz888; Max Pool Size=1500; Min Pool Size=1" providerName="System.Data.SqlClient" />
<add name="House_connectionString" connectionString="server=localhost;database=d0577house;uid=sa;pwd=128897_ka" providerName="System.Data.SqlClient" />
</connectionStrings>



我就是不知道该改为什么样的!谢谢指教
mamaka 2010-08-14
  • 打赏
  • 举报
回复
楼主的说明有些看不懂。。
一般网站用的数据库链接字符串写在web.config中,

<connectionStrings>
<add name="qrconn" connectionString=" data source=(这里写你的IP地址);Initial Catalog=数据库名;Persist Security Info=True;user id=sa;Password=密码;" />
</connectionStrings>

还有端口不要用1433,5000以上随便选一个。。。。
hao1hao2hao3 2010-08-14
  • 打赏
  • 举报
回复
什么路径?

是指

Source=(local);

这个吗?

这是指服务器为本机的服务器

server=localhost

这个也一样。

34,588

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧