GVKun编程网logo

将 React.js MySql 数据表达为变量 嗨!当我遇到一些麻烦时,我正在编写我的网络应用程序

4

如果您想了解将React.jsMySql数据表达为变量嗨!当我遇到一些麻烦时,我正在编写我的网络应用程序的相关知识,那么本文是一篇不可错过的文章,我们将为您提供关于Android中使用firebase

如果您想了解将 React.js MySql 数据表达为变量 嗨!当我遇到一些麻烦时,我正在编写我的网络应用程序的相关知识,那么本文是一篇不可错过的文章,我们将为您提供关于Android 中使用 firebase 的 Unity 插件有一些麻烦!当我使用 ConstraintLayout、c# – 我的网络应用程序在发布时找不到我的数据库、easyUI treeGrid控件遇到的一些麻烦事~、Flask网络应用程序-努力将用户提交的信息导入MySQL数据库的有价值的信息。

本文目录一览:

将 React.js MySql 数据表达为变量 嗨!当我遇到一些麻烦时,我正在编写我的网络应用程序

将 React.js MySql 数据表达为变量 嗨!当我遇到一些麻烦时,我正在编写我的网络应用程序

如何解决将 React.js MySql 数据表达为变量 嗨!当我遇到一些麻烦时,我正在编写我的网络应用程序?

嗨!当我遇到一些麻烦时,我正在编写我的网络应用程序。

**我想让这个类只有在“swishes”(我的 MysqL 数据库中的一个表中的一个值)大于 0 时才会运行。**
     var thepos = 1;
    export default class WishStick extends React.Component {
      render() {      
    var vars = standardwishitems(stars);
    const WishShow = WishResults(stars,vars[0]);
    const anim = pullanim(stars);
    giveItem(vars[1],thepos);
    thepos +=1;
    return(
        <div>
            <Animation />
            {WishShow}
        </div>

    );
}
 }

这是我的服务器代码:

const express = require(''express'');
const bodyParser = require(''body-parser'');
const cors = require(''cors'');
const app = express();
const MysqL = require(''MysqL'');
const {
createPool
} = require(''MysqL'');
const { response } = require(''express'');

const db = createPool({
host:"My ip address :P",user:"my username :P",password:"my password :P",database:"player"
})

const account = createPool({
host:"My ip address :P",database:"account"
})

app.use(cors());
app.use(express.json());
app.use(express.urlencoded({
extended: true
}));

app.get(''/api/get'',(req,res)=>{

const wishes = "SELECT swishes,pwishes FROM account WHERE id = 11";
account.query(wishes,(err,result) => {
    res.send(result);
    
});
});

app.post("/api/insert",res)=>{

const pos = req.body.pos
const vnum = req.body.vnum
const additem = "INSERT INTO player.item (owner_id,pos,count,vnum) VALUES (''11'',?,''1'',?)"
db.query(additem,[pos,vnum],result) => {
    console.log(pos,vnum,err);
})
res.send("a mers");
});
app.listen(3001,() =>{
console.log("running on port 3001");
});

这是 /api/get 的结果:

[{"swishes":999,"pwishes":999}]

我已经尝试过在线搜索,但是我看到并尝试过的每种方法都将查询放入数组并映射到 h1 或 li 标签,这不是我想要做的。我正在尝试将“swishes”中的值转换为变量,假设是wishNum,那么例如我可以这样做 if(wishNum > 0) { return WishStick }else {alert(''你没有足够的愿望!'')}。 你知道我该怎么做吗?

解决方法

我终于明白了伙计们!这就是你的做法:

wishes.map(val => { s_wishes = parseInt(val.swishes)})

示例:

var s_wishes;
const { error,isLoaded,wishes } = this.state;
if (error) {
return <div>Error: {error.message}</div>;
} else if (!isLoaded) {
return <div>Loading...</div>;
} else {
wishes.map(val => { s_wishes = parseInt(val.swishes)});
console.log(s_wishes);
}

Android 中使用 firebase 的 Unity 插件有一些麻烦!当我使用 ConstraintLayout

Android 中使用 firebase 的 Unity 插件有一些麻烦!当我使用 ConstraintLayout

如何解决Android 中使用 firebase 的 Unity 插件有一些麻烦!当我使用 ConstraintLayout?

我在 Unity 中使用了 Firebase。为了在 Android 中使用它,我在 Unity 中构建和导出它。

implementation(name: ''androidx.arch.core.core-runtime-2.0.0'',ext:''aar'')
implementation(name: ''androidx.asynclayoutinflater.asynclayoutinflater-1.0.0'',ext:''aar'')
implementation(name: ''androidx.browser.browser-1.0.0'',ext:''aar'')
implementation(name: ''androidx.coordinatorlayout.coordinatorlayout-1.0.0'',ext:''aar'')
implementation(name: ''androidx.core.core-1.2.0'',ext:''aar'')
implementation(name: ''androidx.cursoradapter.cursoradapter-1.0.0'',ext:''aar'')
implementation(name: ''androidx.customview.customview-1.0.0'',ext:''aar'')
implementation(name: ''androidx.documentfile.documentfile-1.0.0'',ext:''aar'')
implementation(name: ''androidx.drawerlayout.drawerlayout-1.0.0'',ext:''aar'')
implementation(name: ''androidx.fragment.fragment-1.0.0'',ext:''aar'')
implementation(name: ''androidx.interpolator.interpolator-1.0.0'',ext:''aar'')
implementation(name: ''androidx.legacy.legacy-support-core-ui-1.0.0'',ext:''aar'')
implementation(name: ''androidx.legacy.legacy-support-core-utils-1.0.0'',ext:''aar'')
implementation(name: ''androidx.lifecycle.lifecycle-livedata-2.0.0'',ext:''aar'')
implementation(name: ''androidx.lifecycle.lifecycle-livedata-core-2.0.0'',ext:''aar'')
implementation(name: ''androidx.lifecycle.lifecycle-runtime-2.0.0'',ext:''aar'')
implementation(name: ''androidx.lifecycle.lifecycle-viewmodel-2.0.0'',ext:''aar'')
implementation(name: ''androidx.loader.loader-1.0.0'',ext:''aar'')
implementation(name: ''androidx.localbroadcastmanager.localbroadcastmanager-1.0.0'',ext:''aar'')
implementation(name: ''androidx.print.print-1.0.0'',ext:''aar'')
implementation(name: ''androidx.slidingpanelayout.slidingpanelayout-1.0.0'',ext:''aar'')
implementation(name: ''androidx.swiperefreshlayout.swiperefreshlayout-1.0.0'',ext:''aar'')
implementation(name: ''androidx.versionedparcelable.versionedparcelable-1.1.0'',ext:''aar'')
implementation(name: ''androidx.viewpager.viewpager-1.0.0'',ext:''aar'')
implementation(name: ''com.google.android.gms.play-services-ads-identifier-17.0.0'',ext:''aar'')
implementation(name: ''com.google.android.gms.play-services-auth-api-phone-17.4.0'',ext:''aar'')
implementation(name: ''com.google.android.gms.play-services-base-17.6.0'',ext:''aar'')
implementation(name: ''com.google.android.gms.play-services-basement-17.6.0'',ext:''aar'')
implementation(name: ''com.google.android.gms.play-services-measurement-19.0.0'',ext:''aar'')
implementation(name: ''com.google.android.gms.play-services-measurement-api-19.0.0'',ext:''aar'')
implementation(name: ''com.google.android.gms.play-services-measurement-base-19.0.0'',ext:''aar'')
implementation(name: ''com.google.android.gms.play-services-measurement-impl-19.0.0'',ext:''aar'')
implementation(name: ''com.google.android.gms.play-services-measurement-sdk-19.0.0'',ext:''aar'')
implementation(name: ''com.google.android.gms.play-services-measurement-sdk-api-19.0.0'',ext:''aar'')
implementation(name: ''com.google.android.gms.play-services-safetynet-17.0.0'',ext:''aar'')
implementation(name: ''com.google.android.gms.play-services-stats-17.0.0'',ext:''aar'')
implementation(name: ''com.google.android.gms.play-services-tasks-17.2.1'',ext:''aar'')
implementation(name: ''com.google.firebase.firebase-analytics-19.0.0'',ext:''aar'')
implementation(name: ''com.google.firebase.firebase-app-unity-8.0.0'',ext:''aar'')
implementation(name: ''com.google.firebase.firebase-appcheck-interop-16.0.0-beta01'',ext:''aar'')
implementation(name: ''com.google.firebase.firebase-auth-21.0.1'',ext:''aar'')
implementation(name: ''com.google.firebase.firebase-auth-interop-20.0.0'',ext:''aar'')
implementation(name: ''com.google.firebase.firebase-auth-unity-8.0.0'',ext:''aar'')
implementation(name: ''com.google.firebase.firebase-common-20.0.0'',ext:''aar'')
implementation(name: ''com.google.firebase.firebase-components-17.0.0'',ext:''aar'')
implementation(name: ''com.google.firebase.firebase-database-20.0.0'',ext:''aar'')
implementation(name: ''com.google.firebase.firebase-database-collection-18.0.0'',ext:''aar'')
implementation(name: ''com.google.firebase.firebase-database-unity-8.0.0'',ext:''aar'')
implementation(name: ''com.google.firebase.firebase-installations-17.0.0'',ext:''aar'')
implementation(name: ''com.google.firebase.firebase-installations-interop-17.0.0'',ext:''aar'')
implementation(name: ''com.google.firebase.firebase-measurement-connector-19.0.0'',ext:''aar'')
implementation(name: ''com.google.firebase.firebase-storage-20.0.0'',ext:''aar'')
implementation(name: ''com.google.firebase.firebase-storage-unity-8.0.0'',ext:''aar'')
implementation project(''FirebaseApp.androidlib'')

以上是build.gradle(module)的状态 在 android studio 中,它可以正常工作

implementation ''androidx.constraintlayout:constraintlayout:2.0.4''
implementation ''androidx.recyclerview:recyclerview:1.2.0''

但是,如果我在 build.gradle 中使用constraintlayout 或recyclerview 执行上述操作,则会出现以下错误。

Duplicate class androidx.lifecycle.viewmodelProvider$NewInstanceFactory found in modules jetified-androidx.lifecycle.lifecycle-viewmodel-2.0.0-runtime.jar (:androidx.lifecycle.lifecycle-viewmodel-2.0.0:) and lifecycle-viewmodel-2.1.0-runtime.jar (androidx.lifecycle:lifecycle-viewmodel:2.1.0)

Duplicate class androidx.loader.app.LoaderManager$LoaderCallbacks found in modules jetified-androidx.loader.loader-1.0.0-runtime.jar (:androidx.loader.loader-1.0.0:) and loader-1.0.0-runtime.jar (androidx.loader:loader:1.0.0)

 Duplicate class androidx.core.view.accessibility.AccessibilityNodeInfoCompat$CollectionInfoCompat found in modules core-1.3.2-runtime.jar (androidx.core:core:1.3.2) and jetified-androidx.core.core-1.2.0-runtime.jar (:androidx.core.core-1.2.0:)

 Duplicate class android.support.v4.os.ResultReceiver$MyResultReceiver found in modules core-1.3.2-runtime.jar (androidx.core:core:1.3.2) and jetified-androidx.core.core-1.2.0-runtime.jar (:androidx.core.core-1.2.0:)

Duplicate class androidx.annotation.AnyThread found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)

 Duplicate class androidx.arch.core.internal.SafeIterableMap$SupportRemove found in modules core-common-2.1.0.jar (androidx.arch.core:core-common:2.1.0) and jetified-androidx.arch.core.core-common-2.0.0.jar (androidx.arch.core.core-common-2.0.0.jar)

实际的错误信息远不止这些。大约 1000 行

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

c# – 我的网络应用程序在发布时找不到我的数据库

c# – 我的网络应用程序在发布时找不到我的数据库

我使用Visual Studio 2012创建了一个简单的Web应用程序,使用MVC3并在Azure上发布.

当我在本地运行它时,一切正常.但是当我发布时,一个页面中有一个使用我创建的数据库的表不会加载.
错误消息是巨大的,但是从这样开始:

Exception Details: System.ComponentModel.Win32Exception: The system cannot find the   file specified

Source Error: 

An unhandled exception was generated during the execution of the current web request. information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[Win32Exception (0x80004005): The system cannot find the file specified]

[sqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to sql Server. The server was not found or was not accessible. Verify that the instance name is correct and that sql Server is configured to allow remote connections. (provider: sql Network Interfaces,error: 52 - Unable to locate a Local Database Runtime installation. Verify that sql Server Express is properly installed and that the Local Database Runtime feature is enabled.)]
System.Data.sqlClient.sqlInternalConnection.OnError(sqlException exception,Boolean breakConnection,Action`1 wrapCloseInAction) +5296071
System.Data.sqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj,Boolean callerHasConnectionLock,Boolean asyncclose) +558

然后继续.

有三个表,一个是Visual Studio在其Web App示例上创建的Default.
我自己创建的另外两个,并且在发布时都不起作用(在本地时运行完全正常).

我假设问题出现在连接字符串上,如果我还有更多内容,请询问:

<connectionStrings>
 <add name="DefaultConnection" providerName="System.Data.sqlClient" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-Porta-comprimidos-20130503163319;Integrated Security=sspI;AttachDBFilename=|DataDirectory|\aspnet-Porta-comprimidos-20130503163319.mdf" />
<add name="RemedioDBContext"
  connectionString="Data Source=|DataDirectory|\MeuPortaComprimidosDB.sdf"
  providerName="System.Data.sqlClient"/>
<add name="RemedioTempDBContext"
  connectionString=""
  providerName="System.Data.sqlClient"/>

谁能帮帮我吗?我研究了很多,不知道如何处理它(是的,我是新手).

解决方法

您的连接字符串是将数据源设置为LocalDb的设置,默认情况下,Windows Azure计算机上未安装该数据源,您无法使用它(除非您安装它).

您必须将数据库迁移到Windows Azure sql并相应地更改连接字符串.

有关http://msdn.microsoft.com/en-us/library/windowsazure/ee730904.aspx的更多信息

easyUI treeGrid控件遇到的一些麻烦事~

easyUI treeGrid控件遇到的一些麻烦事~

今天做东西用到了easyUI treeGrid控件,treeGrid我还是很少用,基本都用的是dataGrid作展示

遇到的麻烦:

1、加载页面,返回JSON格式OK,树的结构也生成OK,但是在火狐调试下看到如下错误:

在网上也查了一些资料,没有找到我想要的答案。求解。

2、treegrid虽然已经生成,但是所有的子节点鼠标都选不中,只能选中父节点。也不知道跟第一个问题有没有什么关联。

希望大家给我提点解决建议。

Flask网络应用程序-努力将用户提交的信息导入MySQL数据库

Flask网络应用程序-努力将用户提交的信息导入MySQL数据库

python和连接器不接受单个参数。 所以用

    # Insert email into database
    cur.execute("INSERT INTO users (email) VALUES (%s)",(email,))
    mysql.connection.commit()
    cur.close()

关于将 React.js MySql 数据表达为变量 嗨!当我遇到一些麻烦时,我正在编写我的网络应用程序的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于Android 中使用 firebase 的 Unity 插件有一些麻烦!当我使用 ConstraintLayout、c# – 我的网络应用程序在发布时找不到我的数据库、easyUI treeGrid控件遇到的一些麻烦事~、Flask网络应用程序-努力将用户提交的信息导入MySQL数据库等相关知识的信息别忘了在本站进行查找喔。

本文标签: